openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

Handler being unexpectedly disposed by the framework #7833

Closed jsjames closed 4 years ago

jsjames commented 4 years ago

I am updating the Pentair pool binding to use the serial-transport vs. gnu.io (using 2.5.6) I currently have an issue where after all the things go online and the handlers are working well, the framework calls for them to be disposed and then re-initialized. I have changed the logging of org.openhab to DEBUG in an attempt to see what could initiate this. However, just that simple change prevents this issue from being observed. I presume there is some timing bug where enabling the DEBUG logging prevents from happening.

The issue occurs only occurs when I am running on a raspberry pi, so I can only really use logging as means to debug this issue.

1) What conditions would cause the framework to dispose of a handler? Could my binding be asserting? If it did assert, you'd think there be some log message, correct? 2) Any suggestions on how to debug given simple changes to enable DEBUG logging on org.openhab prevent this issue from happening?

Thanks, Jeff

Hilbrand commented 4 years ago

Bindings can be re-initialized when configuration changes. I guess this happens on startup. That process is concurrent. So it can be some configuration is finished loading after bindings are already loaded, due to time it takes to load (maybe having rules cause this) It could be when adding debug this causes some parts to take more time so the part causing the refresh finishes early. So yes it might be a timing issue, certainly given the Raspberry Pi is not the fastest platform.

However, in general it should not a problem a re-initialize is done.

jsjames commented 4 years ago

Thanks for the explanation and this would explain why its happening.