[1.1.0] OS X 10.10.3: IDE: running scripts acting on some Mac apps: work for about 60 seconds, then click/type get really slow --- workaround: use command line instead of app

Bug #1447096 reported by Steen
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SikuliX
Won't Fix
Medium
RaiMan

Bug Description

************ workarounds:

use this to start the IDE from a command line:
java -jar /Applications/SikuliX.app/Contents/Java/sikulix.jar

or use the IDE as usual, but do not run from inside the IDE, but in parallel from a Terminal session (command line)
<path to your setup folder>/runsikulix -r yourScript.sikuli

Since this seems to be some serious problem deep down in the Java Robot implementation with respect to OS X 10.10, a fix might take some time.

The symptom:
about 60 seconds after the first Robot action, the robot extensively delays any mouse and keyboard actions and seems to do some features erroneously or even not at all.

------------------------------------------

on OSX 10.10.3
With nightly build 1.1.0 22-04-2015 and earlier versions

i Get a error when i stop a simple loop script as it gets slow.

for x in range(100):
App.focus("dild")
click(1)
click(2)
click(3)
click(4)
print("at " + str(x))

i get to about 16 loops and its then get realy slow and finds the click´s every 10-20 sec...

when i stop the script it promtes me that:
Possible cause in case you did not touch the mouse while script was running:
mouse actions are blocked generally or by formost application

anybody have any ideas?

Steen (steenc)
description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote :

yes, this was mentioned already before some times.
... but I never could recreate the problem on my MacBook Air with OS X 10.10.3 running Java7 or 8

... but now I will test it again.

I suppose:
"dild" is some application
and 1,2, 3, 4 or some images.
and the click in each case changes the appearance of the GUI

How do you stop the looping script?

Revision history for this message
Steen (steenc) wrote :

Yes right on, i stop the loop CMD + SHIFT + C

Revision history for this message
RaiMan (raimund-hocke) wrote :

ok, this is my test:

switchApp("Safari")
btnEdit = "btnEdit.png"
r1 = Region(0,0,100,100)
r2 = Region(0,700,100,100)
Settings.MoveMouseDelay = 0

for i in range(50):
  r1.highlight(1)
  start = time.time()
  click(btnEdit)
  click("close.png")
  click(btnEdit)
  click("close.png")
  print i, time.time()-start
  r2.highlight(1)

the output:
 2.63800001144
1 2.6130001545
2 2.60300016403
3 2.61199998856
4 2.6220002174
5 1.57100009918
6 2.8599998951
7 2.5039999485
8 2.54499983788
9 2.56699991226
10 2.52699995041
11 2.51999998093
12 1.54600000381
13 3.0
14 2.55900001526
15 1.60700011253
...
35 2.51200008392
36 1.56399989128
37 3.0
38 2.5569999218
39 2.56699991226
40 1.58899998665
41 1.58599996567
42 2.57099986076
43 2.57699990273
44 1.62299990654
45 2.55599999428
46 2.5039999485
47 2.5569999218
48 2.52699995041
49 2.52800011635

as you can see: constant speed for 50 loop turns

what it does:
at the top of this page it clicks the edit button for the title and then the close button

now I will try without the move mouse delay set to 0

Revision history for this message
RaiMan (raimund-hocke) wrote :

no change with the standard mouse move behaviour besides the fact, that the average elapsed time per loop turn is now about 2 seconds more due to the added delays of 0.5 seconds per click.

Revision history for this message
RaiMan (raimund-hocke) wrote :

So what is specific with your situation, which I might be able to reproduce.

Changed in sikuli:
status: New → Opinion
Revision history for this message
Steen (steenc) wrote :

posted a vdeo of my test:
i started to click around when the slowlyness started.......

http://screencast.com/t/kBz61I9vj7zM

RaiMan (raimund-hocke)
Changed in sikuli:
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.0
summary: - OSX 10.10 Yosemite, works for 16 loops then get realy slow
+ [1.1.0] OS X 10.10.3 works for 16 loops, then gets really slow
Revision history for this message
Steen (steenc) wrote : Re: [1.1.0] OS X 10.10.3 works for 16 loops, then gets really slow

Well its freshly installed and updated fully, i installe the JAVA SDK and run sikuli.jar installer.
let me know if you need some logs.

Revision history for this message
Steen (steenc) wrote :
Revision history for this message
Steen (steenc) wrote :
Revision history for this message
Steen (steenc) wrote :

added pictures of which downloads i have used.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Based on your video (thanks for that), I am now able to reproduce the problem with the app Notes.

Interestingly, this is also an app, that cannot be opened with App.open() anymore with 10.10.3
(like some other native Mac apps bug 1445667)

I am using the new AppleScript feature:
runScript('applescript tell app "Notes" to activate')

Seems to be a problem with the Java Robot after-Event handling.
it starts after 60 seconds runtime, which also is the max value to use for a delay after a Robot event.

Now that I know the possible source, I will do some more testing and research.

Thanks for you patience and contribution.

Revision history for this message
Steen (steenc) wrote :

No Problem, Thank you for the best HW/SW test program there is!

RaiMan (raimund-hocke)
summary: - [1.1.0] OS X 10.10.3 works for 16 loops, then gets really slow
+ [1.1.0] OS X 10.10.3: IDE: running scripts acting on some Mac apps:
+ work for about 60 seconds, then gets really slow --- workaround: run
+ form command line
Changed in sikuli:
status: Opinion → In Progress
importance: Undecided → High
RaiMan (raimund-hocke)
summary: [1.1.0] OS X 10.10.3: IDE: running scripts acting on some Mac apps:
- work for about 60 seconds, then gets really slow --- workaround: run
- form command line
+ work for about 60 seconds, then click/type get really slow ---
+ workaround: run script from command line
Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.0] OS X 10.10.3: IDE: running scripts acting on some Mac apps: work for about 60 seconds, then click/type get really slow --- workaround: run script from command line

Thanks for feedback.

Starting the IDE with Java 7: the slowdown does not happen.

Revision history for this message
RaiMan (raimund-hocke) wrote :

... and the App.open() problem is only with Java 8

Revision history for this message
Steen (steenc) wrote :

just downgraded to : java 1.7.0_80 still the same...

Revision history for this message
RaiMan (raimund-hocke) wrote :

Sorry for my wrong comment #14 (due to my mix of Java versions and the different options how to start the IDE)

the version from today has the fix for App.open() for Java8.
later today I will make a new build, that also fixes this for Java 7.

I recommend to go back to Java 8, no need to stick with Java 7.

For other workarounds see the bug mentioned in comment #11

RaiMan (raimund-hocke)
summary: [1.1.0] OS X 10.10.3: IDE: running scripts acting on some Mac apps:
work for about 60 seconds, then click/type get really slow ---
- workaround: run script from command line
+ workaround: use command line instead of app
Changed in sikuli:
status: In Progress → Fix Committed
RaiMan (raimund-hocke)
description: updated
Revision history for this message
Steen (steenc) wrote :

Tested App.open and it works...
tested skuli loop run from commandline and it works.

Revision history for this message
RaiMan (raimund-hocke) wrote :

thanks for feedback.

If you ever get any notice the next days about problems with Java Robot class on OS X 10.10, please let me know.

Revision history for this message
Rayan (rayan512) wrote :

Hi,
I've the same issue ...
I use Java 8, the latest Sikuli build and OS X 10.10.3 and I'm a debutant in Sikuli and programming ^^
I don't have any issue with launching Notes with the App.open( ) command but I've this annoying slow down while running a loop.
Here is a .txt with what I have in the log boxes under the script in Sikuli.
I don't know if you need more information to solve this problem,but if you do just tell me and I will send/post it !

Thanks for your amazing work RaiMan !

Revision history for this message
RaiMan (raimund-hocke) wrote :

@Rayan
thanks for feedback.

--- I don't have any issue with launching Notes with the App.open( )
Sure you do not have ;-)
I found a hack to avoid this problem (see bug 1445667)

--- to get around the slowdown for now ...
... just edit your script in the IDE and save it before running it from the command line in a parallel Terminal session.

--- if you need more information
I do not need any more information, since the cause is rather clear (that is why these extra debugs are shown).
But I do not have any idea in the moment, how to tackle the problem, since it is somewhere deep down in the area, where Java steps down to the native layers of OS X to issue the click action.

Revision history for this message
Rayan (rayan512) wrote :

Thanks for the answer !

I tried to launch my script from the command line by typing this :
/Applications/SikuliXfix/runsikulix -r ../test.sikuli

but unfortunately I got this :

[error] FileManager: Not a valid Sikuli script project:
/Users/Rayan/../test.sikuli

I don't know if I did something wrong, I get this for all my scripts. Moreover, I tried the last build with the temporary fix for the slowdown but I still got it ...

Revision history for this message
RaiMan (raimund-hocke) wrote :

--- I tried to launch my script from the command line by typing this :
.. in filenames of scripts on command line are not yet supported.

you either be in the folder containing test.sikuli and say:
/Applications/SikuliXfix/runsikulix -r test.sikuli

... or you are somewhere else then you have to use:
/Applications/SikuliXfix/runsikulix -r <absolute path to>/test.sikuli

-- I tried the last build with the temporary fix for the slowdown
for me it works.
so check again wether you really use the latest build version.

... but if you are right and still get the slowdown, I would be interested in what you are exactly doing.

Revision history for this message
Steen (steenc) wrote :

@Rayan

Remeber to use the:
java -jar /application/sikulix.app/contens/java/sikulix.jar -r /users/test/test.sikuli
this is my example fill in with your path to your tests.
cd drag and drop is good i OSX.

RaiMan (raimund-hocke)
Changed in sikuli:
importance: High → Medium
milestone: 1.1.0 → 2.0.0
Revision history for this message
Junior Ese (junior.ese) wrote :

@RaiMan

I've been using the new mac OS and this bug seems to be happening with the new Mac OS version 10.13.1 that was released a few weeks ago, I'm using the OS with SikulixIDE 1.1.1, Java version 8.

I'll be using the work around in the mean time but thought I'd let you know in case you haven't had anything come through with the use of MacOS v10.13.1.

Revision history for this message
RaiMan (raimund-hocke) wrote :

@Junior Ese
Thanks for information.
Just tested on my macOS 10.13.1 with Java 8 latest using the above test, but could not find any slow down within 2 minutes.
Running SikuliX 1.1.2, but should not make a difference.

So could you tell more about the symptoms you see.

Revision history for this message
Junior Ese (junior.ese) wrote :
Download full text (4.0 KiB)

@RaiMan

I've only been using SikuliX for a number months and so am still pretty new with the tool as well as the Python language.

I'm currently using two versions of Mac OS, 10.12.6 and then I have a iMac on 10.13.2 which seems to be the problem child. Both Mac OS's are using Sikulix 1.1.2 and its the iMac that seems to be displaying the symptoms related this bug.

Automation Setup:-
iMac version 10.13.2
sikuliX version 1.1.2 (IDE)
Java version 8

macbook pro OS version 10.12.6
sikuliX version 1.1.2 (IDE)
Java version 8

Sikulix setup and test runs:-
I have no problems with the macbook pro, all tests run smoothly and quickly with no [debug] KeyPress: extended delay: 10010, just the iMac.

I have a single script with all my functions, then call upon them via another script. As I mentioned before, I'm pretty new to Python and coding in general.

The following messages are displayed when i run tests via the iMac:

[log] DOUBLE CLICK on L(2351,1246)@S(0)[0,0 2560x1440] (551 msec)

[log] DOUBLE CLICK on L(1646,396)@S(0)[0,0 2560x1440] (548 msec)

[log] DOUBLE CLICK on L(1813,362)@S(0)[0,0 2560x1440] (549 msec)
[log] TYPE "NewTest#TAB."

[log] TYPE "#ENTER."

[log] TYPE "#TAB."
[log] TYPE "A#TAB."

[log] TYPE "14#TAB."

[log] TYPE "MyStreet#TAB."

[log] TYPE "Wollongong#TAB."

[log] CLICK on L(2152,443)@S(0)[0,0 2560x1440] (525 msec)

[log] CLICK on L(1972,488)@S(0)[0,0 2560x1440] (524 msec)

[log] DOUBLE CLICK on L(1963,486)@S(0)[0,0 2560x1440] (549 msec)

[log] CLICK on L(2144,482)@S(0)[0,0 2560x1440] (525 msec)

[log] CLICK on L(2249,361)@S(0)[0,0 2560x1440] (524 msec)

[log] CLICK on L(2220,482)@S(0)[0,0 2560x1440] (524 msec)
[log] TYPE "2500#TAB."

[log] TYPE "0255733978#TAB."

[log] TYPE "<email address hidden>#TAB."

[log] TYPE "mytestwebsite.com.au#TAB."

[log] TYPE "0452493687#TAB."

[log] TYPE "0255833978"

[debug] MouseDown: extended delay: 10010

[log] CLICK on L(1719,340)@S(0)[0,0 2560x1440] (10825 msec)

[debug] MouseDown: extended delay: 10010

[debug] MouseUp: extended delay: 10010
[log] DOUBLE CLICK on L(1646,578)@S(0)[0,0 2560x1440] (20755 msec)

[debug] MouseDown: extended delay: 10010

[debug] MouseUp: extended delay: 10010

[debug] MouseDown: extended delay: 10010

[debug] MouseUp: extended delay: 10010
[log] DOUBLE CLICK on L(1809,725)@S(0)[0,0 2560x1440] (40542 msec)
[log] TYPE "Billing Name Field"

[debug] KeyPress: extended delay: 10010

[debug] KeyPress: extended delay: 10010

[debug] KeyRelease: extended delay: 10010

[debug] KeyRelease: extended delay: 10011

[debug] KeyPress: extended delay: 10010

[debug] KeyRelease: extended delay: 10010

[debug] KeyPress: extended delay: 10010

[debug] KeyRelease: extended delay: 10010

[debug] KeyPress: extended delay: 10010

[debug] KeyRelease: extended delay: 10010

[debug] KeyPress: extended delay: 10010
[debug] KeyRelease: extended delay: 10010

[debug] KeyPress: extended delay: 10010

[debug] KeyRelease: extended delay: 10010

[debug] KeyPress: extended delay: 20009

[debug] KeyRelease: extended delay: 20009

[debug] KeyPress: extended delay: 20010

[debug] KeyRelease: extended delay: 20009

[debug] KeyPress: extended delay: 20010

[debug] KeyPress: extended delay: ...

Read more...

Revision history for this message
Junior Ese (junior.ese) wrote :

@RaiMan

Let me know if you need any further information.

Revision history for this message
RaiMan (raimund-hocke) wrote :

@Junior Ese
Updated my MacBook Pro and my iMac to macOS 10.13.2.

Made the following test with a Terminal window being open before scriptstart.

def xdelay(text, start, step):
  dur = int((time.time() - start)*1000)
  if (step == 0 or dur > 500):
    print text + ":", int((time.time() - start)*1000)

switchApp("terminal")
Settings.MoveMouseDelay = 0
nums = "0123456789"
scriptStart = time.time()
type(Key.ENTER)
type("clear")
type(Key.ENTER)
wait(1)
oneMin = True
for k in range(10):
  for i in range(10):
    start = time.time()
    click()
    xdelay("click", start, i)
    start = time.time()
    type(nums[i])
    xdelay("type", start, i)
    wait(1)
    if (oneMin and time.time() - scriptStart > 60):
      print "***** 1 minute exceeded"
      oneMin = False
      type("x")
      break

... and had no problems.

Could you please run the test script in your faulty environment.

Revision history for this message
Junior Ese (junior.ese) wrote :

@RaiMan

Appreciate the help. As instructed, I executed the test script as advised and have attached the log. This was completed on the iMac environment.

Environment:-
>iMac (version 10.13.2)
>SikuliX 1.1.2
>Java 8

Test Steps:-
>Copy and pasted 'test script' from RaiMan to sikuli
>Open Terminal as instructed
>Select 'Run' on sikuli to execute script
>Script competed

Let me know if theres anything else required.

Thanks again.

RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Won't Fix
milestone: 2.0.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.