a41943041024 Posted October 1, 2024 Posted October 1, 2024 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?
argumentum Posted October 1, 2024 Posted October 1, 2024 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.
a41943041024 Posted yesterday at 04:16 AM Author Posted yesterday at 04:16 AM 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.
Nine Posted yesterday at 01:25 PM Posted yesterday at 01:25 PM (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 yesterday at 01:29 PM by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
KaFu Posted 16 hours ago Posted 16 hours ago 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() OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
a41943041024 Posted 3 hours ago Author Posted 3 hours ago 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now