Gateway timer scripts not running

Hi,

I’ve some troubles with my gateway timer scripts.
First of all, they all are in fixed rate and dedicated, with a delay from 1s to 10mn.
Sometime, they freeze in a strange way: in my browser on the status page for gateway scripts, everything seems fine, but in reality they are not executed (I have input/output counters for every single one). There is no error in logs.
I noticed it happens more often when one script used to synchronize databases, a pretty huge sql stored procedure which take between 10s to 45s for a delay of 2mn, is enable.
Something else: there is another project with its own scripts (fixed rate/dedicated too) and they still running normally while mine are freezing.
I executed every script in the script console to check errors, but everything seems clear.
I’m using 7.9.8.

An idea about what’s happening ?

Thanks.

1 Like

I have also just experienced this issue as well. Client is understandably annoyed that certain actions have not completed, that are supposed to happen every hour.

Each and every timer script, no matter what it’s interval settings, will not execute again while a previous invocation is still running. Anything you do in your timer scripts that cannot always be executed within the event period must be sent to an asynchronous thread, unless the non-overlapping condition is desirable. Consider having each troublesome event log on start and again on finish so it is obvious how log it is taking, and a missing finish will tell you that something is getting stuck. I’ve yet to see one of these situations not be programmer error.

My issue turned out to be the script was hanging, which caused the Gateway timed task to hang, and not be able to execute again, as pturmel was saying.
Once i fixed the underlying issue with the script hanging, i had no more problems with Gateway timer scripts running regularly.

1 Like

Is it a better option to use timeout function like python “Signal” library function to raise exception and come out of the particular hanging thread ??? so that timer script does not hang forever ?

Is this method safe? Please suggest

Not sure it would work. Jython threads are really java threads. They don't like to be externally killed. They have an interrupt feature that could be used (and I recommend), but that requires the thread to regularly check its own .interupted() status. See the related advice in this topic: