Potential Bug Report - Disabling a Running Tag Event Script - Running Scripts

Hi All,

A bit of an odd circumstance but thought I would report / open up for discussion.

I have a tag with a long running tag event script.

If the script is running, I can see it in the Gateway -> Status -> DIAGNOSTICS -> Running Scripts (where I can terminate it if needed).

While it is running, if I go to the tag and disable the tag event script, it disappears from Gateway -> Status -> DIAGNOSTICS -> Running Scripts but I can see that it is actually still running as its functionality is still apparent and now I have no way of terminating it short of restarting the gateway (not tested yet).

This is really bad for your system. Tag events run in a limited thread pool. Not only should they not run long enough to show up in diagnostics, they shouldn't run more than single digit milliseconds.

Consider breaking such long operations down into phases that can run from a state machine, and implement the state machine with a timer event or project tag change event (not on the tag). Those won't bog down the rest of your system.

Hi Phil, thanks for your input, what I will say is that I have had it running for weeks without any noticeable change to system performance when it starts or while its running. If I see system performance reducing at a future date, I will terminate the script and see if that improves things and if so, I will implement something like what you have described. I think simply moving it to a project tag change event would work without any changes but has the draw back of it needing the project in order to run - I kind of like that it is not project dependent.

Gateway Tag Change events, while specific to projects, do not need a client running in order to execute.

1 Like

Yes I get that, I just like that the 'resource' isn't hidden within a specific project.

Allowing any long-running script on a tag is playing with fire. The kind that yields 2am phone calls. Tags already need a gateway scripting project to utilize library scripts. I recommend you make a leaf project to be your gateway scripting project and place relevant scripts there. No event script should be more than a one-liner pointing at a library script, regardless.

Playing. With. Fire.


Thanks for your extra input, I really do appreciated it.

You don't have to tell me thrice (or maybe it is more that you don't have to warn me about this potentially causing 2am phone calls twice)! :sweat_smile: Changed it to a gateway event tag script.

Tested again and now it seems to behave how I want/expect - disabling the long running project gateway event script does not stop the script or hide it from the Gateway -> Status -> DIAGNOSTICS -> Running Scripts page so I can still terminate it.