I have a very stange jython behavior running my new python rules in openhab 2.3. I tried already some debugging to get some deeper understanding whats happen.
I ported my first 40 rules to python and in the beginning they are running fine. But after a while I get a lot of “org.python.core.PyException” if I try to get their state.
So I added some debug statements. I’m logging the string representation of each item where I want to get the state. If everything runs well I get a string representation like
PlantSensorInfo (Type=StringItem, State=Feucht genug, Label=Planzen Status, Category=selfrain)
This looks like a normal python object. Here I can access the state without any problems. But after a while, some items are becomming “dirty”. I’m not able to access their state. Every time I try to call getState I’m getting this “org.python.core.PyException” exception.
A string representation of this problematic items looks like this
PlantSensorInfo <org.eclipse.smarthome.core.library.items.StringItem object at 0x16>
and the StackTrace looks like this
2018-06-14 10:50:01.798 [ERROR] [.automation.core.internal.RuleEngine] - Failed to execute rule '81f67cf1-b773-47cc-bfd2-f35e07664e23': Failed to execute action '1': null
2018-06-14 10:50:01.798 [DEBUG] [.automation.core.internal.RuleEngine] -
java.lang.RuntimeException: Failed to execute action '1': null
at org.eclipse.smarthome.automation.core.internal.RuleEngine.executeActions(RuleEngine.java:1013) [207:org.eclipse.smarthome.automation.core:0.10.0.oh230]
at org.eclipse.smarthome.automation.core.internal.RuleEngine.runRule(RuleEngine.java:823) [207:org.eclipse.smarthome.automation.core:0.10.0.oh230]
at org.eclipse.smarthome.automation.core.internal.RuleEngineCallbackImpl$TriggerData.run(RuleEngineCallbackImpl.java:91) [207:org.eclipse.smarthome.automation.core:0.10.0.oh230]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: org.python.core.PyException
at org.python.core.Py.SystemError(Py.java:275) ~[?:?]
at org.python.core.Deriveds.__findattr_ex__(Deriveds.java:59) ~[?:?]
at org.python.core.PyObjectDerived.__findattr_ex__(PyObjectDerived.java:1036) ~[?:?]
at org.python.core.PyObject.__getattr__(PyObject.java:1025) ~[?:?]
at marvin.helper$py.getItemState$2(/dataDisk/openhab-runtime/python/marvin/helper.py:23) ~[?:?]
at marvin.helper$py.call_function(/dataDisk/openhab-runtime/python/marvin/helper.py) ~[?:?]
at org.python.core.PyTableCode.call(PyTableCode.java:171) ~[?:?]
at org.python.core.PyBaseCode.call(PyBaseCode.java:139) ~[?:?]
at org.python.core.PyFunction.__call__(PyFunction.java:413) ~[?:?]
at org.python.pycode._pyx104.execute$6(<script>:48) ~[?:?]
at org.python.pycode._pyx104.call_function(<script>) ~[?:?]
at org.python.core.PyTableCode.call(PyTableCode.java:171) ~[?:?]
at org.python.core.PyBaseCode.call(PyBaseCode.java:308) ~[?:?]
at org.python.core.PyBaseCode.call(PyBaseCode.java:199) ~[?:?]
at org.python.core.PyFunction.__call__(PyFunction.java:482) ~[?:?]
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[?:?]
at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[?:?]
at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[?:?]
at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[?:?]
at org.python.core.PyObject._jcallexc(PyObject.java:3644) ~[?:?]
at org.python.core.PyObject._jcall(PyObject.java:3676) ~[?:?]
at org.python.proxies.__builtin__$MyDetailRule$281.execute(Unknown Source) ~[?:?]
at org.eclipse.smarthome.automation.module.script.rulesupport.shared.simple.SimpleRuleActionHandlerDelegate.execute(SimpleRuleActionHandlerDelegate.java:34) ~[?:?]
at org.eclipse.smarthome.automation.module.script.rulesupport.internal.delegates.SimpleActionHandlerDelegate.execute(SimpleActionHandlerDelegate.java:60) ~[?:?]
at org.eclipse.smarthome.automation.core.internal.RuleEngine.executeActions(RuleEngine.java:1005) ~[?:?]
... 7 more
this are just examples. It does not happen for the same item every time. So the items which becomes dirty is a random item every time. Some items are also recovering their reference after a while.
I guess that the python objects are losing their reference to the java counterpart.
has anyone an idea or hint how to solve this or how to debug it deeper.
… I created also a eclipse issues.