rudi Posted August 27, 2018 Posted August 27, 2018 (edited) Hi, any suggestion to track down, why a script is freezing after a longer run time? This is a general question, I've checked the common mistakes, I've made so far (inside a loop doing fileopen() without fileclose(), runwait() for progs, that don't terminate, infinite recursive loops etc.) This script stops just after several days of running... Is there a direct way to "count" the amount of MEM and handles, a autoit script is using itself, or by child processes? Regards, Rudi. Edited August 27, 2018 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
FrancescoDiMuro Posted August 27, 2018 Posted August 27, 2018 Hi @rudi Genereally, a script freezes because something happened, and that something does handle the script "in pause". If you could post the script, we can take a look and see if there's something which could cause that Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Moderators Melba23 Posted August 27, 2018 Moderators Posted August 27, 2018 rudi, Adding Opt("TrayIconDebug", 1) at the top of the script will tell you where the script has paused, which might give you valuable pointers to where the problem lies. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rudi Posted August 27, 2018 Author Posted August 27, 2018 Hi, the script is quite long, so I'll attach it. TrayIconDebug in this case doesn't help, as this is a Windows installation to operate a industrial machine, there is just a web GUI covering all of the screen, no task bar, so no systray. Main script: tshark-D-und-Ringbuffer-alle-NICs.au3 2nd, external script: SNMP-OID-auslesen.au3, using SNMP_UDF_v1.7.3.au3 (UDF from this site) The script is using TSHARK.EXE -D to get all local NICs Then it's looking for a local disk to save the trace files to and starts capturing to a ring buffer on all found NICs Then it's placing a minimal GUI to indicate by one single button, when the operator of the machine is facing issues, that might be LAN related. when the button is pressed, the 2nd script is launched to read some OID values from the switches, listed in the INI file. "@" is replaced by [1..8] = the number of ports of the used switches. Regards, Rudi. tbe-tshark-scrip-hang-autoit-forums.zip Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Earthshine Posted August 27, 2018 Posted August 27, 2018 you can attach just the source files too. easier, plus I don't know what's in that zip My resources are limited. You must ask the right questions
rudi Posted August 27, 2018 Author Posted August 27, 2018 Hello Earthshine, to know, what's in a ZIP file, just look into it that never ever harms In that ZIP file there are are exactly the sources you ask for, on top the Win-Unix-Tooltail.exe, as well as a URL to download wireshark. That's all required to exactly redo the required environment to run my scripts. If you don't like that tail, pick one from google. And wireshark is obviously pointing towards the offical download site for wireshark. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Zedna Posted August 28, 2018 Posted August 28, 2018 I recommend to add to your program option for logging to file. In INI add option Logging=1 And in program at important places add writing important states to LOG file. After crash/freeze of your program you will see at the end of LOG file, where was problem just before hanging. Here is example: $ini_logging = IniRead($ini, "Setup", "Logging", "0") If $ini_logging == '1' Then $log = @ScriptDir & '\' & StringReplace(@ScriptName,'.exe','.log') ; your program ... _Log('') ... $A = ... _Log('start: var A=' & $A) ... Func _Log($text) If $ini_logging == '1' Then If Not($text == '') Then $text = @YEAR & '-' & @MON & '-' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC & '.' & @MSEC & ': ' & $text FileWrite($log, $text & @CRLF) EndIf EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search
rudi Posted August 29, 2018 Author Posted August 29, 2018 @Zedna I'll give it a try, thx. A way to check, what a script itself is "consuming" is possibly available as well? (RAM, Handles, CPU usage, nested-loop-deepth, ...) Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Earthshine Posted August 29, 2018 Posted August 29, 2018 (edited) for professional logging look no further than log4a.au3 found in the samples forum. and do this in the main AU3 file, all others just include the log4a.au3 #include 'log4a.au3' #Region ;**** Logging **** ; Enable logging and don't write to stderr _log4a_SetEnable() ; Write to stderr, set min level to warn, customize message format _log4a_SetErrorStream() _log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE) _log4a_SetMinLevel($LOG4A_LEVEL_DEBUG) ; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled _log4a_SetFormat("${date} | ${host} | ${level} | ${message}") #EndRegion ;**** Logging **** In that configuration, the logger will log to your Editor output window, if compiled it creates a log file automatically with the script name. you can set your own minimum levels and stuff. Edited August 29, 2018 by Earthshine Xandy 1 My resources are limited. You must ask the right questions
rudi Posted August 30, 2018 Author Posted August 30, 2018 Thanks for pointing out this UDF Earth is flat, pigs can fly, and Nuclear Power is SAFE!
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