New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[jsscripting] Fix memory leak on script execution failure #16578
[jsscripting] Fix memory leak on script execution failure #16578
Conversation
Add-on part of the fix for openhab#16462. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
...ng/src/main/java/org/openhab/automation/jsscripting/internal/DebuggingGraalScriptEngine.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Make engineIdentifier a instance field to ease debugging. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@jlaur I have now pushed my improvement. It basically stringifies the first 5 elements of the stack trace (that should be enough for the JS part of the stack trace in most cases) so we still have a part of the stack trace, but Pax Logging does not hold a ref to the exception. I have also checked this change again with VisualVM, it does not re-introduce the memory leak. FYI I also made the engine identifier an instance field for OpenhabGraalJSScriptEngine because it really really eases debugging. |
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
The log message now looks like:
And if there is a JS stack trace:
|
This reverts commit 4bb4977. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
...ng/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for fixing this nasty memory leak!
Add-on part of the fix for #16462.