Jump to content

Scripts stops running after a While...


Recommended Posts

Hello!

I created a sort of Scheduler app to control a Broadcast Video Server via API.

After a while (about 3 weeks) it stops running.

Since last problem, i added some trace to help me figure out what is the problem.

It failed last week and i am unable to figure out what went on.

Let me present parts of the code below that represent the heart of the app.

Part1:

The Tray Icon Items

Even if this part is non trivial for the App, it allowed me to figure out that when the app seems to be inactive i am still able to see and act with the Tray Items and they work!

Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause
Opt("TrayOnEventMode", 1) ;0=disable, 1=enable
Opt("TrayMenuMode", 3)
TrayCreateItem("Lancer " & $sServerAddress)
TrayItemSetOnEvent(-1, "_Browser")
TrayCreateItem("") ; Create a separator line.
TrayCreateItem("Test-Debug App")
TrayItemSetOnEvent(-1, "_TestScript")
TrayCreateItem("") ; Create a separator line.
TrayCreateItem("Quit App")
TrayItemSetOnEvent(-1, "_ExitScript1")
TraySetState(1) ; Show the tray menu.
TraySetToolTip("CaptureScheduler")

Part2:

AdlibRegister ("_EachSecondTimer" ,1000)
AdlibRegister ("_DelayTimer" ,int($TimerDelay*1000))
AdlibRegister ("_MultipliedDelayTimer" ,int(($TimerDelay*1000)*$TimerMultiplier))

The Heart of the App runs on 3 triggers + the Background running loop(see below)

-One, each second

-The second, predefined Delay (ex.: 10sec)

-The third, predefined Delay Multiplied by a Factor (ex.: 10sec x 3)

When each of these triggers, i write a Timestamp Marker to a ini file, so i can see which part would/could fail once the problematic state has been detected.

Last week, All of them stopped updating the ini inside the same minute .. (even the the Background running loop marker/timestamp)

See the code below...

local $LoopCounter=0
While 1
    sleep(100)
    $LoopCounter=$LoopCounter+1
    if $LoopCounter > 100 Then
        if IniRead($Path & "Capture.ini","Config","Get_Heartbeat",0) =1 then
            iniwrite($Path & "Capture.ini","Config","Heartbeat1", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
        endif
        $LoopCounter=0
    endif
Wend

Func _EachSecondTimer()
    _IsItTime()
    _ManageDEL()
    _ManageADD()
    _ManageROUTE()
    _ManageStop()
    if IniRead($Path & "Capture.ini","Config","Get_Heartbeat",0) =1 then
        iniwrite($Path & "Capture.ini","Config","Heartbeat0", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
    Else
        iniwrite($Path & "Capture.ini","Config","Heartbeat0","")
    endif
endfunc

Func _DelayTimer()
    if IniRead($Path & "Capture.ini","Config","Get_Heartbeat",0) =1 then
        iniwrite($Path & "Capture.ini","Config","Heartbeat", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
    elseif IniRead($Path & "Capture.ini","Config","Get_Heartbeat",0) = 0 then
        if IniRead($Path & "Capture.ini","Config","Heartbeat","") <> "" then
            iniwrite($Path & "Capture.ini","Config","Heartbeat","")
        endif
    endif
endfunc

Func _MultipliedDelayTimer()
    if IniRead($Path & "Capture.ini","Config","Get_Heartbeat",0) =1 then
        iniwrite($Path & "Capture.ini","Config","Heartbeat2", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
    endif
    _GenerateUserLogPage()
    if @compiled = 1 then _UpdateStatus()
    $MultipleTimes=0
    _TimelinejsonMaker()
endfunc

Obviously, some may say that i come from the functions called each seconds:

_IsItTime() , _ManageDEL() , _ManageADD() , _ManageROUTE() , _ManageSTOP()

And i don't disagree.

However, if the "once a seconds" function, called by the AdlibRegister gets stuck, does it also stuck the other AdlibRegisters to trigger?

Maybe i should add an additional Timestamps around the Functions to figure out if the issues occurs in/between them.

Anyone see an other possibility?

Thanks

 

Link to post
Share on other sites
  • Developers
7 hours ago, webbit said:

However, if the "once a seconds" function, called by the AdlibRegister gets stuck, does it also stuck the other AdlibRegisters to trigger?

Yes, AutoIt is single threaded.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Have you checked your AV ?  I had a similar problem last year, a process that was running fine stopped all of the sudden.  Of course, that was a false positive...

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...