Skip to content
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] After some time ALL ECMA2021 JavaScript scripts are not working anymore #12566

Closed
Sascha-L opened this issue Apr 2, 2022 · 3 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@Sascha-L
Copy link

Sascha-L commented Apr 2, 2022

openHAB 3.3.0 M1
Windows 10 Pro x64

All of my ECMA2021 JS scripts are working fine, without any erros. After some days none of them are working anymore, because openHAB throws exceptions for any keyword, namespace, etc.

Example:

2022-04-02 11:53:20.728 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:
org.graalvm.polyglot.PolyglotException: ReferenceError: "time" is not defined
	at <js>.:program(<eval>:1) ~[?:?]
	at org.graalvm.polyglot.Context.eval(Context.java:379) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:426) ~[?:?]
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) ~[java.scripting:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutocloseable.java:51) ~[bundleFile:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:69) ~[bundleFile:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutocloseable.java:51) ~[bundleFile:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:69) [bundleFile:?]
	at org.openhab.core.automation.module.script.internal.handler.ScriptConditionHandler.isSatisfied(ScriptConditionHandler.java:54) [bundleFile:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.calculateConditions(RuleEngineImpl.java:1151) [bundleFile:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:987) [bundleFile:?]
	at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:89) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]
2022-04-02 11:53:20.728 [ERROR] [ernal.handler.ScriptConditionHandler] - Script execution failed: org.graalvm.polyglot.PolyglotException: ReferenceError: "time" is not defined
2022-04-02 11:53:25.712 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:
org.graalvm.polyglot.PolyglotException: ReferenceError: "time" is not defined
	at <js>.:program(<eval>:1) ~[?:?]
	at org.graalvm.polyglot.Context.eval(Context.java:379) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:426) ~[?:?]
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) ~[java.scripting:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutocloseable.java:51) ~[bundleFile:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:69) ~[bundleFile:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutocloseable.java:51) ~[bundleFile:?]
	at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:69) [bundleFile:?]
	at org.openhab.core.automation.module.script.internal.handler.ScriptConditionHandler.isSatisfied(ScriptConditionHandler.java:54) [bundleFile:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.calculateConditions(RuleEngineImpl.java:1151) [bundleFile:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:987) [bundleFile:?]
	at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:89) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

It seems that the whole environment/runtime to execute those ECMA2021 JS scripts is crashed and not working anymore. The more often ECMA2021 JS scripts are executed, the earlier this issue happens.

@wborn wborn transferred this issue from openhab/openhab-distro Apr 2, 2022
@wborn wborn changed the title After some time ALL ECMA2021 JavaScript scripts are not working anymore [jsscripting] After some time ALL ECMA2021 JavaScript scripts are not working anymore Apr 2, 2022
@wborn wborn added the bug An unexpected problem or unintended behavior of an add-on label Apr 2, 2022
@wborn
Copy link
Member

wborn commented Apr 10, 2022

Maybe @digitaldan or @jpg0 has an idea why it crashes?

@digitaldan
Copy link
Contributor

This sounds like a memory leak, my guess is there is OOM error earlier in the logs somewhere. Its possible this is related to #12577 or possibly openhab/openhab-core#2897 which was just fixed a few days ago in the core.

@Sascha-L
Copy link
Author

Sascha-L commented Apr 26, 2022

Hi,

directly after I read your comment that there was just commited a fix, I installed the Snapshot (Build #2857) version. Since then it is running and running and running without any issues anymore! Great! :-) Also the WebUI is very fast now. Until Milestone 2 the WebUI was getting slower and slower day after day - maybe due to the memory leakage.

So the issue seems to be fixed! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

3 participants