Gateway timer scripts stops running while saving

I have 3 small gateway timer scripts on 300ms fixed delay running on dedicated threads. Their basic function is to keep int value alive, so plcs knows communication is working as intented. Two times now one of these scripts has stopped running after saving some small changes to project. They were working fine for months. After first one I added logger to exception, but it didn´t return anything.

It seems to run at least once, but then last execution time starts increasing
Example about what im running.
There is also several other timer scripts, but it seems to only affect this one.

import system
server = ‘server’
path = ‘path’
oldQualifiedValue = system.opc.readValue(server, path)
newValue = oldQualifiedValue.getValue() + 1
if newValue > 10000:
newValue = 0
system.opc.writeValue(server, path, newValue)

Look in your logs for an error. Scripts get reloaded in the gateway on project save, and if any syntax error was added, any events that call those script modules will fail on their first attempt. Which will be logged (once).

I didn´t make any changes to that specific script, something completely unrelated. It started to work after saving again and adding 1ms to timer. There was nothing in logs related to it. Not in diagnostics → logs, nor gateway scripts section in gateway. It´s pretty strange one, as at the start it seems to run once or so and after that stops. If you don´t save anything it does not seem to occur other times.
Unfortunately it happened again, so I quess I´ll make a ticket if no one has good ideas how to fix it. Propably hard to do when there is so little information.

Every time I've looked at one of these it was programmer error. Usually something in the jython script waiting forever. A thread dump might show the problem. Put a logger in the beginning of the event and the end of the event that include printing the thread name. When you see the beginning but not the end, get the backtrace for that thread.