openHAB 3.4 Milestone discussion

Looks like it’s not missing

{
  "uri": "channel-type:http:channel-config",
  "parameters": [
    {
      "description": "Transformation pattern used when receiving values. Chain multiple transformations with the mathematical intersection character \"∩\".",
      "label": "State Transformation",
      "name": "stateTransformation",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": false,
      "verify": false,
      "limitToOptions": true,
      "options": [],
      "filterCriteria": []
    },
    {
      "description": "Transformation pattern used when sending values. Chain multiple transformations with the mathematical intersection character \"∩\".",
      "label": "Command Transformation",
      "name": "commandTransformation",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": false,
      "verify": false,
      "limitToOptions": true,
      "options": [],
      "filterCriteria": []
    },
    {
      "description": "This value is added to the base URL configured in the thing for retrieving values.",
      "label": "State URL Extension",
      "name": "stateExtension",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": true,
      "verify": false,
      "limitToOptions": true,
      "options": [],
      "filterCriteria": []
    },
    {
      "description": "This value is added to the base URL configured in the thing for sending values.",
      "label": "Command URL Extension",
      "name": "commandExtension",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": true,
      "verify": false,
      "limitToOptions": true,
      "options": [],
      "filterCriteria": []
    },
    {
      "default": "false",
      "description": "This specifies whether the URL is already escaped. Applies to the base URL, commandExtension and stateExtension.",
      "label": "Escaped URL",
      "name": "escapedUrl",
      "required": false,
      "type": "BOOLEAN",
      "readOnly": false,
      "multiple": false,
      "advanced": true,
      "verify": false,
      "limitToOptions": true,
      "options": [],
      "filterCriteria": []
    },
    {
      "description": "Content for state request (only used if method is POST/PUT)",
      "label": "State Content",
      "name": "stateContent",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": true,
      "verify": false,
      "limitToOptions": true,
      "options": [],
      "filterCriteria": []
    },
    {
      "default": "READWRITE",
      "label": "Read/Write Mode",
      "name": "mode",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": true,
      "verify": false,
      "limitToOptions": true,
      "options": [
        {
          "label": "Read/Write",
          "value": "READWRITE"
        },
        {
          "label": "Read Only",
          "value": "READONLY"
        },
        {
          "label": "Write Only",
          "value": "WRITEONLY"
        }
      ],
      "filterCriteria": []
    }
  ],
  "parameterGroups": []
}

Anything else I can check?

No, I guess it’s a race condition, the thing is initialized before the channel state descriptions are loaded. You can probably ignore it.

OK thanks.
As I said, everything appears to be working anyway.

FTR: Fix ThingManager is missing config description during normalization by J-N-K · Pull Request #3191 · openhab/openhab-core · GitHub will fix this issue.

2 Likes

I have a general question…will OH3.4 need Java 17 or what is the status about Java 17?

OH 3.4 will most likely run with Java17, but required is Java11.

The switch to Java17 as minimum version will happen after the release.

1 Like

Hello any chance to see this in OH3.4 Add a scene editor to Main UI by J-N-K · Pull Request #1520 · openhab/openhab-webui · GitHub

1 Like

Just upgraded to 3.4.0.M6 and now have the following in openhab.log:

2022-12-11 16:15:57.546 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.
2022-12-11 16:16:15.937 [INFO ] [ort.loader.AbstractScriptFileWatcher] - Loading script '/opt/openhab/conf/automation/js/garage.js'
2022-12-11 16:17:29.996 [WARN ] [ipt.internal.ScriptEngineManagerImpl] - Script evaluation of 'file:/opt/openhab/conf/automation/js/garage.js' takes more than 30000ms
2022-12-11 16:17:30.027 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'Runnable.run()' on 'org.openhab.core.automation.module.script.interna
l.ScriptEngineManagerImpl$$Lambda$1493/0x993a0428@aa16a2': Multi threaded access requested by thread Thread[OH-safeCall-3,5,main] but is not allowed for language(s) js.
java.lang.IllegalStateException: Multi threaded access requested by thread Thread[OH-safeCall-3,5,main] but is not allowed for language(s) js.
        at com.oracle.truffle.polyglot.PolyglotEngineException.illegalState(PolyglotEngineException.java:129) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.throwDeniedThreadAccess(PolyglotContextImpl.java:1034) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.checkAllThreadAccesses(PolyglotContextImpl.java:893) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:723) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:1991) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterIfNeeded(PolyglotEngineImpl.java:1919) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotValueDispatch.hostEnter(PolyglotValueDispatch.java:1227) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.getBindings(PolyglotContextImpl.java:1040) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextDispatch.getBindings(PolyglotContextDispatch.java:98) ~[?:?]
        at org.graalvm.polyglot.Context.getBindings(Context.java:560) ~[?:?]
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.invokeFunction(GraalJSScriptEngine.java:548) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.invokeFunction(DelegatingScriptEngineWithInvocableAndAutoclose
able.java:123) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.invokeFunction(InvocationInterceptingScriptEngineW
ithInvocableAndAutoCloseable.java:119) ~[?:?]
        at org.openhab.automation.jsscripting.internal.OpenhabGraalJSScriptEngine.invokeFunction(OpenhabGraalJSScriptEngine.java:233) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.invokeFunction(DelegatingScriptEngineWithInvocableAndAutoclose
able.java:123) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.invokeFunction(InvocationInterceptingScriptEngineW
ithInvocableAndAutoCloseable.java:119) ~[?:?]
        at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.lambda$5(ScriptEngineManagerImpl.java:307) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        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-12-11 16:17:30.194 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'Runnable.run()' on 'org.openhab.core.automation.module.script.interna
l.ScriptEngineManagerImpl$$Lambda$1493/0x993a0428@1303c1b': Multi threaded access requested by thread Thread[OH-safeCall-3,5,main] but is not allowed for language(s) js.
java.lang.IllegalStateException: Multi threaded access requested by thread Thread[OH-safeCall-3,5,main] but is not allowed for language(s) js.
        at com.oracle.truffle.polyglot.PolyglotEngineException.illegalState(PolyglotEngineException.java:129) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.throwDeniedThreadAccess(PolyglotContextImpl.java:1034) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.checkAllThreadAccesses(PolyglotContextImpl.java:893) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:723) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:1991) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterIfNeeded(PolyglotEngineImpl.java:1919) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotValueDispatch.hostEnter(PolyglotValueDispatch.java:1227) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.getBindings(PolyglotContextImpl.java:1040) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextDispatch.getBindings(PolyglotContextDispatch.java:98) ~[?:?]
        at org.graalvm.polyglot.Context.getBindings(Context.java:560) ~[?:?]
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.invokeFunction(GraalJSScriptEngine.java:548) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.invokeFunction(DelegatingScriptEngineWithInvocableAndAutoclose
able.java:123) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.invokeFunction(InvocationInterceptingScriptEngineW
ithInvocableAndAutoCloseable.java:119) ~[?:?]
        at org.openhab.automation.jsscripting.internal.OpenhabGraalJSScriptEngine.invokeFunction(OpenhabGraalJSScriptEngine.java:233) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.invokeFunction(DelegatingScriptEngineWithInvocableAndAutoclose
able.java:123) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.invokeFunction(InvocationInterceptingScriptEngineW
ithInvocableAndAutoCloseable.java:119) ~[?:?]
        at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.lambda$5(ScriptEngineManagerImpl.java:307) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        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-12-11 16:17:30.273 [INFO ] [ort.loader.AbstractScriptFileWatcher] - Loading script '/opt/openhab/conf/automation/js/keypads.js'
2022-12-11 16:17:37.640 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/opt/openhab/conf/automation/js/garage.js': java.io.IOException: Stre
am closed

1 Like

I like to raise attention here to [iCloud] Bridge-Thing generates Communication Error · Issue #13282 · openhab/openhab-addons · GitHub. I worked on a PR in the last weeks which is currently in review. Without the PR the current iCloud binding is useless.

1 Like

We really appreciate you work, but there are also other PRs waiting.

In the meantime, you can publish your working version through the marketplace so other users can install it easily and test it further.

Ok, thats a good suggestion, if it finally doesn’t make into into 3.4 and users request it. Personally I can live with compiling it by myself and putting the jar into the addons folder :wink:

:+1:
But you still need to provide a link to the .jar file in the marketplace.

I saw a similar error in my environment. But as I am new to JS Scripting my first intention was that I am using an outdated or incompatible Java version. Disabled JS Scripting again and did not dig deeper into it.

Probably related to this change:

With respect to the near release we should put this on a high priority.

//CC @ccutrer and @J-N-K

1 Like

@cweitkamp

I think is definitely related to the PR you linked, since the log messages first say that the evaluation timed out and after this it fails.
The multithread access issue is from JS Scripting, but it did never occur before that change.
I can reproduce by making sure that script evalutation takes more then the 30000 ms timeout from of the safe caller:

const Thread = Java.type('java.lang.Thread');
Thread.sleep(35000);

@cweitkamp @ranielsen
Can you please provide some information about your system?
Hardware platform (e.g. Raspberry Pi 4), OS, Java version.

@ranielsen : do you know what your script was doing at that time? It looks like the SafeCaller is doing exactly what it’s supposed to do - warn you that the script has apparently hung by taking longer than 30s to load. Do you have other JS scripts that normally load after garage.js? And prior to M6 they do eventually load? How long after garage.js did they load?

As for the threading errors, yes they appear to be the JS Engine not being happy about another thread trying to interrupt it. @florian-h05 will have to dig deeper on that. I generally use JRuby, not JS. JRuby will generally ignore the request for the script to forcefully unload, unless the script itself registers for an unload hook to respond and try to clean itself up (which my helper library does). Looking at the JSEngine’s code it implements AutoClosable so I assumed it would handle it fine - I did not anticipate threading issues.

@ccutrer On older, less powerful platforms I can imagine that loading a JS script with many dependencies takes more than 30000ms.

I think we could also change something about the implementation, I‘ll probably comment on your PR.

And I thought Ruby was slow ;).

2 Likes

@ranielsen Can you share the script?

@hmerk If I understand it correctly, the iCloud binding is currently completely broken and thus should not be delivered with 3.4 at all, unless this PR is being merged. So I tend to agree with @maihacke that this deserves some attention and moving it merely to the marketplace is not really an option, wdyt?

3 Likes

My foreign Scripting Engine is Jython. The timeout while loading a rule appears for it too.

Raspberry Pi 4
Raspberry Pi OS (Debian Bullseye)
OpenJDK 11.0.16+8

No, I did not.

Here is my exact log of the approach to migrate one of my rules to JS Scripting. There is only one simple JSRule definition in the file - without any external user-definded dependencies:

2022-12-10 13:48:48.438 [INFO ] [ort.loader.AbstractScriptFileWatcher] - Loading script '/etc/openhab/automation/js/telephone.js'
2022-12-10 13:49:57.722 [WARN ] [ipt.internal.ScriptEngineManagerImpl] - Script evaluation of 'file:/etc/openhab/automation/js/telephone.js' takes more than 30000ms
2022-12-10 13:49:57.753 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'Runnable.run()' on 'org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl$$Lambda$1743/0x56371428@17a2399': Multi threaded access requested by thread Thread[OH-safeCall-16,5,main] but is not allowed for language(s) js.
java.lang.IllegalStateException: Multi threaded access requested by thread Thread[OH-safeCall-16,5,main] but is not allowed for language(s) js.
        at com.oracle.truffle.polyglot.PolyglotEngineException.illegalState(PolyglotEngineException.java:129) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.throwDeniedThreadAccess(PolyglotContextImpl.java:1034) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.checkAllThreadAccesses(PolyglotContextImpl.java:893) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:723) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:1991) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterIfNeeded(PolyglotEngineImpl.java:1919) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotValueDispatch.hostEnter(PolyglotValueDispatch.java:1227) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextImpl.getBindings(PolyglotContextImpl.java:1040) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotContextDispatch.getBindings(PolyglotContextDispatch.java:98) ~[?:?]
        at org.graalvm.polyglot.Context.getBindings(Context.java:560) ~[?:?]
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.invokeFunction(GraalJSScriptEngine.java:548) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.invokeFunction(DelegatingScriptEngineWithInvocableAndAutocloseable.java:123) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.invokeFunction(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:119) ~[?:?]
        at org.openhab.automation.jsscripting.internal.OpenhabGraalJSScriptEngine.invokeFunction(OpenhabGraalJSScriptEngine.java:233) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.invokeFunction(DelegatingScriptEngineWithInvocableAndAutocloseable.java:123) ~[?:?]
        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.invokeFunction(InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.java:119) ~[?:?]
        at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.lambda$5(ScriptEngineManagerImpl.java:307) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]