Ignition Memory increasing after Scripting Restart

Hello there,

i wrote some functions in a shared Script which are called from an UDTs valueChanged event. Now every time i save some Changes i made in my Script and the Scripting restarts because of that the Memory usage is grwoing a bit.
After that the Memory performs normal but is generally on a higher level.
What could cause such a behaviour and is there a way to 1. Bring down memory to the usual level and 2. Avoid this in the future?

Thanks for help

Hello. We have seen saves cause this exact issue. What version of Ignition are you running?

Frank

I am on Version 8.1.17

Can you upgrade to the latest stable release? I believe a fix was put into one of the newer releases to address this issue.

Frank

If you are using system.util.invokeAsynchronous to launch long-lived threads, and you don't kill them off when the project is saved, then you are leaking the entire Jython interpreter infrastructure every time. Also applies to misuse of event scripts that do not complete quickly (infinite loops, or very long tasks).

There's no Ignition fix if this is what you are doing.

There is an update coming in 8.1.23 that corrects for some orphaned objects that weren't getting cleaned up on project scripting restart. The growth here was very small though and manifested more when there were a lot of inherited projects. It is definitely worth taking a look at what @pturmel mentioned above...

2 Likes

Thank you, i will check if i can upgrade and see if this fixes my issue!

Thanks, I already looked into this and can't find anything what would cause something like this... But i will take a closer look

Yeah, the growth for every restart is very small but adds up over time..

Okay. Again, thank you for your answer.
After looking more deeper into some Scripting i found that the system.util.invokeAsynchronous is used.
It is used in the Project library in a shared syript of my "Global" Project from which a few other projects inherit. Now i would like to close the thread if i restart my Scripting but don't quite know how I would do this right now.
I know that system.util.invokeAsynchronous returns the executing thread also that the Gateway Event Update script runs every time i restart my Scripts. Now my idea would be that in the Gateway Event Update i test if my thread is still running and if so kill it off.
How is it possible to safe the executing thread? How do i make sure that the thread i want to kill off is actually the one i called my function on? So in general, how would i kill off the thread when i save my project ?

It isn’t safe to kill threads. Threads can and should be designed to be interruptible (checking for interrupt status and/or exceptions for graceful exit). If you didn’t do that, interrupt() may not work. If not, you will have to restart the gateway.

Start here:

Some other search results:

https://forum.inductiveautomation.com/search?q=kill%20invokeAsynchronous

https://forum.inductiveautomation.com/search?q=persistent%20thread%20leak