Jump to content

Recommended Posts

Posted

I have a script uses imported openCV to do something. (No need to have related knowledge, because this post may only interest to error handling)

The key codes are as below:

 

;import related DLLs
;and config variables, there are too many rows and not related to error
_WinAPI_BitBlt($hDstDC, 0, 0, 3840, 1080, $hDesktopSrcDC, 40, 0, $SRCCOPY)
Local $obj = ObjCreate("OpenCV.cv.Mat")
Local $dst = $obj.create(1680, 3840, $iType, $pBits, $iStep).clone()

 

$obj is created via commands from openCV DLL, this DLL is from outside source and not recommended to change privately.

The code in actual environment sometimes throws out a -1073741819 error, which has been identified as 5th Parameter of call BitBlt function (1080) is smaller than 1st parameter of $obj.create (which is 1680). On happening, The Script brutely exits leaving this error code, along with all undone work halted halfway.

Unfortunately I tried many ways and shows out there is no way to handle this error; This includs using ObjEvent, Using OnAutoitExitRegister etc. Is there any possible way to catch this error? At least there would be some way to do some post works before termination?

Posted
24 minutes ago, a41943041024 said:

No need to have related knowledge

ok

25 minutes ago, a41943041024 said:
Local $obj = ObjCreate("OpenCV.cv.Mat")
Local $dst = $obj.create(1680, 3840, $iType, $pBits, $iStep).clone()

use IsObj() ?

25 minutes ago, a41943041024 said:

Is there any possible way to catch this error?

nah. Is a memory thing. ( No need to have related knowledge )

26 minutes ago, a41943041024 said:

At least there would be some way to do some post works before termination?

IPC everything you're doing to elsewhere just in case it crashes with whatever data you need from that, before the crash. 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

  • 4 months later...
Posted

I have a script that runs automated tasks including identify on-screen objects and operate with keyboard/mouse. However it will always crash after running for some time.

Code cannot be shared due to confidential purpose (and I believe it's not code issue since I don't use 3rd party lib nor use a lot CPU resource) Detail symptom as below

1. After restart computer and run script, script will have high chance to crash at accumulatively run ~20-30 hrs (pause script/exit-restart script pauses timing), leaving error code -1073740791

2. If restart the script right away after crash, it has chance to run less than a minute then crash again with same error code,crash time/module seems random; in such case, script will always behave unstably even restart again, must restart computer

3. This error can not be handled by autoit including using codes like ```Local  $oMyError = ObjEvent("AutoIt.Error", "handleCOMErrorFunc")```. When crash happens, we can find the entry from system event log and showing this is 'BEX64' error

4. Making 'clean RAM' operations (like close then restart an app using large memory) will notably decrease the chance of #1/#2 happening, but eventually this will be not effective after 5-7 days

5. There is some small chance that when script crashes, whole screen turns black/white and non-related apps behave abnormally or crashes. This won't happen if script is not running

6. Open Taskmgr and find my script (either run from Autoit3.exe or build with exe) it shows memory/CPU is always using at a low state(~30M/<5%, while a pressure test shows memory leak would occur at ~200M)

 

I'm not purposed to ask a final solution from this post, however could someone share some ways on how to find/debug on where might be the potential problem? Thanks.

Posted (edited)

You could automatically reboot your computer every 15 hours or so.  But this implies that the user doesn't have a password or that you can run your script without a session.

Edited by Nine
Posted
18 hours ago, a41943041024 said:

identify on-screen objects

Maybe you don't close all handles correctly? That might choke your system.
Check that all open handles are closed, for files and graphic objects. Take a look at these functions (among others, most common):

FileClose()
StdioClose()
_WinAPI_CloseHandle()
_WinAPI_DeleteObject()
_GDIPlus_BitmapDispose()
_GDIPlus_GraphicsDispose()

Posted
12 hours ago, KaFu said:

Maybe you don't close all handles correctly? That might choke your system.
Check that all open handles are closed, for files and graphic objects. Take a look at these functions (among others, most common):

FileClose()
StdioClose()
_WinAPI_CloseHandle()
_WinAPI_DeleteObject()
_GDIPlus_BitmapDispose()
_GDIPlus_GraphicsDispose()

The object detect is as simple as PixelGetColor and PixelChecksum etc. The only thing is total use count; frequency is 2k/hr on average;

Additionally, I'm curious that can those objs being not closed in a crashed session will affect a new session?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...