Gateway event script not triggering on tag change

Hi,

LogCycle is increased +1 many times a day. Each time a script should trigger. If I open the gateway script interface, does nothing and saves the script it starts working again for the rest of the day. Nothing in the logs, gateway script status says success and triggered 2 days ago.

Version 8.1.14 and now updated to 8.1.15, still the same.

A normal day, yellow spikes are trigger events so its many times a day, all days of the week

Additional info,

The last time I fixed it was Thursday last week, open, save and it works again. I see it stopped the same day we did upgrade to 8.1.15, is this a known issue? Do we need to open and close the gateway event dialog after any update?

Get a thread dump next time you notice it has stopped.

That I can do.

Add logging to the event that shows when it starts, at various points within, and then finishes. So you can catch when it doesn’t finish and approximately how far it got before hanging.

(Gateway event scripts for a specific event will not run in parallel–each must finish before the next event will run.)

1 Like

It stopped again, 21 hours ago.

I don’t know how much the thread dump is worth now, so many hours after.
There is 3 gateway-tags-eventscripts is in state Waiting.

As you see it takes almost a second to run the script. The trigger is a counter in the PLC, when a new cycle has been registered it inc by one, another int tag containing bits representing what trigger is also set.

The script reads 500 OPC UA items and stores them in the SQL server, and set trigger to zero. This is not done, so something in the script obviously fails.

It was working so fine a few weeks back… from the programmer excuse book. I will add a “try” in my script, and an exception that reset the trigger.

Can you upload the thread dump?

I PM’ed you a link :slight_smile:

Hmm, I do not see the corresponding thread at all. Those 3 you saw “WAITING” are for tag event scripts, not gateway tag change scripts.

This thread would have a name like gateway-tagchangescripts-project[$PROJECT].

I don’t see it at all, which is strange. If your logs go back far enough to when the execution stopped you can search for something like “Uncaught Throwable during execution” and see if you find anything.

Uncaught throwable, I find some but they are 3 days old and perspective-related.

Hmm. Strange. I’d move forward with some logging before, during, and after, as well as adding a big try/except around the whole thing and printing any errors just in case.

It looks like the thread being absent might just mean the script hasn’t executed in a long enough time that the cached thread pool let it go, and that makes sense considering you said it hasn’t executed in 21 hours.

Another interesting thing might be to add a 2nd gateway tag change script for the same tag that does nothing but print a log message with the tag value and announce that it ran.

I added a big try / except as suggested. Will add logging to see if I can find what stops it.

Thanks for the follow up guys!

I discovered it has stopped again. The log says it passed the script without issues, the reset trigger is the last function in the try part. The except only resets the trigger and log "Sequence failed".

I think I can conclude with that the script runs but there is some timing issues between Ignition and the PLC leaving the triggers hang.

system.tag.write([p_xxxx]xxxx_ChemCont/triggerCount,0)

logger = system.util.getLogger(xxxx newCycle)
logger.info(Reset trigger)

system.tag.write is asynchronous. Replace that with writeBlocking or writeSynchronous and capture the quality code returned.