Macro Scheduler stability issues

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rnoecker
Junior Coder
Posts: 25
Joined: Fri Jun 07, 2013 4:44 pm

Macro Scheduler stability issues

Post by rnoecker » Thu Jun 27, 2013 3:03 pm

I've had stability issues in Windows 7 when developing on my own computer which I attributed to the software not handling bad scripts properly, however, I am now having an issue in a testing environment. I get an "msched.exe has stopped working" error and this always happens eventually although it may run for hours with the script running at 10 minute intervals. The number of script executions that happen before the crash vary, and I can sometimes get around 30 runs.

It doesn't seem to crash at any particular point in the script. The script itself does a little bit of browser automation, but it mainly uses image detection since it interacts with an application running through Citrix.

I don't know if the problem can be attributed to multiple runs or whether there is a chance of failing on any single run. I am using the AutoLogon functionality to lock/unlock which means the same process is being used. A new process would be created if it was fully logging off each time, and that might help with the issue, but I can't test it because I am using the trial version and it shows the nag dialog after the automatic logon (which seems odd since this is a full featured trial).

Environment
Macro Scheduler v14.0.12e
Windows 7 32 bit virtual machine

Script example
// reports top level menu
WaitScreenImage>%BMP_DIR%\menu_reports.bmp,%matchCoefficient%,CCOEFF
if>WSI_TIMEDOUT=FALSE
FindImagePos>%BMP_DIR%\menu_reports.bmp,SCREEN,%matchCoefficient%,7,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Else
GoSub>ErrorHandler,There was a problem accessing the reports menu
Endif
Else
GoSub>ErrorHandler,There was a problem accessing the reports menu
Endif

Windows event log
Faulting application name: msched.exe, version: 1.0.0.0, time stamp: 0x51cad05e
Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec49b60
Exception code: 0xc0000374
Fault offset: 0x000c380b
Faulting process id: 0x20f00
Faulting application start time: 0x01ce72b797fbab37
Faulting application path: C:\Program Files\Macro Scheduler 14\msched.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: a202596a-df25-11e2-be30-080027702d1b

rnoecker
Junior Coder
Posts: 25
Joined: Fri Jun 07, 2013 4:44 pm

Post by rnoecker » Thu Jun 27, 2013 8:01 pm

Here is a screenshot (if the image worked) of a crash that happened after 20 executions over a 3 hour period. I stayed logged in so that I could monitor the memory usage, and the usage was around 35-40 and it looked like it was freeing up memory after each run, however, you can see that at the time of the crash it was using 150 MB. Although it may have slowly leaked up to this amount, I think that maybe an action caused it to spike up to this amount and crash.

Image

It should be somewhere in the following code at this point as this is right after the application is loaded using Citrix. I wonder if the finding of the needle while the haystack is still loading (for up to 30 seconds) may be an issue.

// logout and close browser
IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
If>ie_res=0
GoSub>ErrorHandler,There was a problem clicking the link to log out of the site
Endif
IEQuit>IE[0],ie_res
If>ie_res=1
GoSub>ErrorHandler,There was a problem closing IE
Endif

SetFocus>%windowHandle%
// reset mouse position and click to make sure nothing is focused or open
GoSub>ResetMousePosition

// open up report options
// reports top level menu
WaitScreenImage>%BMP_DIR%\menu_reports.bmp,%matchCoefficient%,CCOEFF
if>WSI_TIMEDOUT=FALSE
FindImagePos>%BMP_DIR%\menu_reports.bmp,SCREEN,%matchCoefficient%,7,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Else
GoSub>ErrorHandler,There was a problem accessing the reports menu
Endif
Else
GoSub>ErrorHandler,There was a problem accessing the reports menu
Endif

SRT>ResetMousePosition
WaitScreenImage>%BMP_DIR%\titleBar.bmp,%matchCoefficient%,CCOEFF
if>WSI_TIMEDOUT=FALSE
FindImagePos>%BMP_DIR%\titleBar.bmp,SCREEN,%matchCoefficient%,7,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Else
GoSub>ErrorHandler,There was a problem resetting the mouse cursor position
Endif
Else
GoSub>ErrorHandler,There was a problem resetting the mouse cursor position
Endif
END>ResetMousePosition

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jun 28, 2013 6:22 am

Which version of Macro Scheduler are you running?

Please make sure you have the latest build which fixed a memory leak in FindImagePos. That could be the cause of your problem.

Failing that please enable logging and then look at the log file to see where in the script the problem occurs.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

rnoecker
Junior Coder
Posts: 25
Joined: Fri Jun 07, 2013 4:44 pm

Post by rnoecker » Fri Jun 28, 2013 2:44 pm

I gave the version in my original post (see that or below). I downloaded it after you reported fixing the memory leak. Also, I did notice that the memory being used at this time if 50 MB which is more than the 35-40 MB I observed before. I'm not sure if it is to be expected that it would use more memory after running for awhile.

I added a wait before the section I suspected was causing the problem (while the application loads in Citrix) and it looks like it failed there. It is strange that the line that failed was the wait (based on a start and no end), and that makes me think it may be associated with the closing of the browser which happens right before that. I am going to do some more runs to see if it always happens at that point.


Environment
Macro Scheduler v14.0.12e
Windows 7 32 bit virtual machine


// logout and close browser
IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
If>ie_res=0
GoSub>ErrorHandler,There was a problem clicking the link to log out of the Marketron site
Endif
IEQuit>IE[0],ie_res
If>ie_res=1
GoSub>ErrorHandler,There was a problem closing IE
Endif

Wait>30
SetFocus>%windowHandle%
// reset mouse position and click to make sure nothing is focused or open
GoSub>ResetMousePosition

// open up report options
// reports top level menu
WaitScreenImage>%BMP_DIR%\menu_reports.bmp,%matchCoefficient%,CCOEFF
if>WSI_TIMEDOUT=FALSE
FindImagePos>%BMP_DIR%\menu_reports.bmp,SCREEN,%matchCoefficient%,7,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Else
GoSub>ErrorHandler,There was a problem accessing the reports menu
Endif
Else
GoSub>ErrorHandler,There was a problem accessing the reports menu
Endif


6/28/2013 10:01:26:582 - START: 76: // logout and close browser
6/28/2013 10:01:26:582 - END: 76: // logout and close browser
6/28/2013 10:01:26:582 - START: 77: IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
6/28/2013 10:01:28:176 - END: 77: IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
6/28/2013 10:01:28:191 - START: 78: If>ie_res=0
6/28/2013 10:01:28:191 - END: 78: If>ie_res=0
6/28/2013 10:01:28:191 - START: 81: IEQuit>IE[0],ie_res
6/28/2013 10:01:28:207 - END: 81: IEQuit>IE[0],ie_res
6/28/2013 10:01:28:207 - START: 82: If>ie_res=1
6/28/2013 10:01:28:207 - END: 82: If>ie_res=1
6/28/2013 10:01:28:207 - START: 85:
6/28/2013 10:01:28:207 - END: 85:
6/28/2013 10:01:28:207 - START: 86: Wait>30

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jul 01, 2013 1:36 pm

Did you narrow it down to the close? What happens if you try closing the browser with a CloseWindow or ALT-F4 or something instead?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

rnoecker
Junior Coder
Posts: 25
Joined: Fri Jun 07, 2013 4:44 pm

Post by rnoecker » Mon Jul 01, 2013 6:44 pm

It seems to be failing on the closing of the browser using the specialized method. I've done a couple other tests, and it has failed either on the IEQuit line or soon after it (in the one case above it failed on a Wait immediately following the IEQuit).

I will try to close the window using an alternate technique to see if it helps, although I don't like the idea of having to use that as a solution as it doesn't seem as neat and reliable as the specialized method.


Here is the tail of the log from my last test. I got 14 runs before it failed.

7/1/2013 13:26:22:098 - START: 76: // logout and close browser
7/1/2013 13:26:22:098 - END: 76: // logout and close browser
7/1/2013 13:26:22:098 - START: 77: IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
7/1/2013 13:26:23:457 - END: 77: IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
7/1/2013 13:26:23:473 - START: 78: If>ie_res=0
7/1/2013 13:26:23:473 - END: 78: If>ie_res=0
7/1/2013 13:26:23:473 - START: 81: IEQuit>IE[0],ie_res

rnoecker
Junior Coder
Posts: 25
Joined: Fri Jun 07, 2013 4:44 pm

Post by rnoecker » Tue Jul 02, 2013 1:30 am

It failed again after 15 runs. This time it shows the end for the IEQuit as the last line in the log file which again shows it happens on the IEQuit or soon after.

7/1/2013 19:26:31:423 - START: 76: // logout and close browser
7/1/2013 19:26:31:423 - END: 76: // logout and close browser
7/1/2013 19:26:31:423 - START: 77: IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
7/1/2013 19:26:33:048 - END: 77: IEClickTag>IE[0],,,A,ID,logoutAreaLogoutLink,is_res
7/1/2013 19:26:33:048 - START: 78: If>ie_res=0
7/1/2013 19:26:33:048 - END: 78: If>ie_res=0
7/1/2013 19:26:33:064 - START: 81: IEQuit>IE[0],ie_res
7/1/2013 19:26:33:095 - END: 81: IEQuit>IE[0],ie_res

rnoecker
Junior Coder
Posts: 25
Joined: Fri Jun 07, 2013 4:44 pm

Post by rnoecker » Fri Jul 19, 2013 4:38 pm

I am now using the close window method to close the window and the program is no longer crashing. This indicates to me that the IEQuit has a definite problem since it consistently crashed the program usually withing 20 runs of my script.

I am using Windows 7 with IE 10 (I think it was 10 when the crashes where happening unless there was an auto update if IE at some point).

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts