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

[ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'RULE-NAME': null #3752

Closed
BOFH90 opened this issue Aug 12, 2023 · 4 comments · Fixed by #3754
Closed
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@BOFH90
Copy link

BOFH90 commented Aug 12, 2023

After the Upgrade to OH4.0, some of my rules won´t run for the first time they are triggerd.
It seems like it´s mostly the case if a trigger condition is reused for a few times for different rules.
In the openhab.log are the following errors:

example:
[ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'usv-6': null or
[ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'rasenmaeher-2': null

an with trace enabled:

│2023-08-12 17:25:00.206 [DEBUG] [e.automation.internal.RuleEngineImpl] -                                                                                          │
│java.util.ConcurrentModificationException: null                                                                                                                   │
│       at java.util.HashMap.computeIfAbsent(HashMap.java:1221) ~[?:?]                                                                                             │
│       at org.openhab.core.automation.internal.RuleEngineImpl.getContext(RuleEngineImpl.java:1103) ~[?:?]                                                         │
│       at org.openhab.core.automation.internal.RuleEngineImpl.updateContext(RuleEngineImpl.java:1090) ~[?:?]                                                      │
│       at org.openhab.core.automation.internal.RuleEngineImpl.setTriggerOutputs(RuleEngineImpl.java:1079) ~[?:?]                                                  │
│       at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:992) ~[?:?]                                                             │
│       at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:87) ~[?:?]                              │
│       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]                                                                          │
│       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:1136) ~[?:?]                                                                  │
│       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]                                                                  │
│       at java.lang.Thread.run(Thread.java:833) ~[?:?]

this rule is defines in rules/usv.rules:

rule "USV Batteriewarnung EG"
when
	Item EG_USV_Status changed
then
    if ((EG_USV_Status.state == "OB DISCHRG") || (EG_USV_Status.state == "OB") || (EG_USV_Status.state == "CB")) {
    	executeCommandLine("/home/openhab/signal-api.sh", "Achtung: USV-EG läuft auf Batterie", "+123")
    }
    else {
        //alles gut
    }
end

or an even simpler one:

// Triggers:
// - When GEM_Regensensor changed

// context: rasenmaeher-2
sendCommand(GEM_Rasenmaeher_Regentimer, ON)

If the rule is triggered again, everything just works until i restart openhab. This does not affect every rule, but some of them.

Expected Behavior

the rules should be executed without any error as in previous versions like 3.5.

Current Behavior

the following entry appears in openhab.log:
[ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'usv-6': null

Your Environment

latest openHAB 4.0.1 on Debian AMD64 via apt with Zulu-17 installed.

@BOFH90 BOFH90 added the bug An unexpected problem or unintended behavior of the Core label Aug 12, 2023
@chrostek
Copy link

same problem here. seems to affect only rules that use the same trigger. sometimes some of them end in this null error

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/after-migration-to-oh4-and-java-17-some-of-my-rules-won-t-work-with-error-null/148021/10

@J-N-K
Copy link
Member

J-N-K commented Aug 12, 2023

Can you add a log statements at the top of the rule

logInfo("myRule", "triggered")
logInfo("myRule", "state = " + EG_USV_Status.state)

I'm not sure if you need to add an additional .toString after .state, try that if it fails to run.

@BOFH90
Copy link
Author

BOFH90 commented Aug 12, 2023

I already did add some LogInfo´s to the top of my rules, just to see if they triggered, but it never appeared in the Logfile when the error-message in openhab.log appeared. It seems like the rule doesn´t get executed in the first place rather than not fully executed.

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 the Core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants