Jump to content
rudi

Howto track down, why a script is freezing (long run)

Recommended Posts

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 by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

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


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Hello Earthshine,

to know, what's in a ZIP file, just look into it :bye: 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!

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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 by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • By Tersion
      Here test example:
      The code is not prefect, but it's demonstrates the problem.
      So, when I download more than 2 files simultaneous from one server (in my example I download 3 simultaneously) by InetGet() with background option, I will get only 2 active downloads. It's seems like server limitation. The third will remain with 0 read bytes until one of the previous downloads would finished. And if I want to close this third 0 bytes read download with InetClose() I will get hang of Window GUI for several seconds! After that, the third download would be closed and everything will continue to work normally.
      If I InetClose() one of the active downloads with more than 0 bites read - all works fine!
      You can try by your self given example, or watch this .gif's:
      1. Window GUI hangs when I trying to Cancel (InetClose()) download with 0 bytes read download:

      2. All works as it should, when I Cancel more than 0 bytes read download:

      Any ideas why is it happens?
    • By Blueman
      Hi all,
      I was wondering if you can help me with the function called; InetRead().
      My scripts are using this function a lot for several conditions and everything works fine!
      But sometimes when the server is a little bit buggy of simply not available my script is hanging.
      It takes about 90sec before this function returns a Timeout, when i adjust the parameter it still is hanging about 90sec.
      The following script is a example where the script is hanging for aprox. 90sec;
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.geenverbinding.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      The following script is a example where the script show the Msgbox pretty fast;

       
      ; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.google.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")  
      My question now is, what am i doing wrong and/or is there a other way to prevent Hanging the script?
      Thanks all
       
    • By Shedunn
      I recently installed AutoIT(the most recent version) on my work computer and everytime I try to use Koda to generate code for a GUI Koda freezes....nothing can be clicked on and I have to use task manager to end the task.  It doesn't seem to matter if I open a file or if I try with a fresh design.  It also freezes if I try to change any settings within Koda

      I've tried uninstalling everything AutoIT related and reinstalling and restarting the computer.  No matter what it still does it
       
      Is there a setting somewhere that could be causing this?
    • By harrigme
      This is probably very basic but I am trying to run Koda FormDesigner and if I click on "Generate Form Code" or "Generate Options" it freezes the program.  Any ideas on how to fix this?
    • By ruslanas402
      Greeting, so I've been trying to come up with solution, but no luck. Despite I tried to automate upload function, I released that it freezes after "Choose File to Upload" window appears..
       
      #include <IE.au3> ;#include <_Dbug.au3> Global $oIE = _IECreate("http://tinypic.com/", 1) Global $upload2 = _IEGetObjById($oIE, "the_file") _IEAction($upload2, "click") ;Sleep(1000) $hWnd = WinGetHandle("Choose File to Upload") MsgBox(0, "", $hWnd) Have anybody faced this situation?
      btw: srry for the advertise Besides it's no matter which site I'm trying to do this it's all the same.
×
×
  • Create New...