-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[homekit] quick restart on network changes #12072
Conversation
Signed-off-by: Eugen Freiter <freiter@gmx.de>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/homekit-no-response-error-on-all-openhab-items/118200/175 |
Regression of #11720, looking at this might ease review. |
Some additional hints: in my logs I see that the reaction to short network interruptions is somewhat random. One event either causes no restart, one restart or two consecutive restarts. Looks like, depending on the actual timing, the network change listener either doesn't catch the event at all, or just one added or removed interface event, or both the removed and added events. So would it make sense to add some debouncing? Also, what I don't understand: why would we restart the bridge at all if the interface has just been removed, or if a different, unused network interface changes? Shouldn't a restart only be necessary if the used interface actually changes to a different address? However, this would make it necessary to evaluate the reoved and added, so it's not as straight forward as the current solution. |
good idea. it just one check which does not make it too complex but maybe reduce number of restart. added to PR |
Signed-off-by: Eugen Freiter <freiter@gmx.de>
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Eugen Freiter <freiter@gmx.de>
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Eugen Freiter <freiter@gmx.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* quick restart on network changes * only restart if needed * add null check Signed-off-by: Eugen Freiter <freiter@gmx.de>
Here's my first feedback after serveral days of testing (with a slightly modified code, as I also wanted to catch the added interfaces in the log; code can be found here). Really seems to be an improvement enhancing stability, had no issues so far. Stopping and starting of the bridge now is skipped when an (anyway unused IPv6) interface gets removed or added, which happens quite often. Number of actual restarts thus is considerably reduced. Actual restarts in case of a network interruption seem to behave well now, though accessories still get removed from the accessory list. This is due to the fact that on removing the interface all connections to subscribing devices get terminated, and in this case the SubscriptionManager unsubscribes all characteristics. However, as the restart of the bridge only is triggered by a second event when the network interface is added again, and this typically happens in the order of several seconds later, nothing gets messed up. To illustrate this, I copied a few lines from the log: Still I think that onChanged at least theoretically could be entered a second time before finishing the first time, as the network changes appear as separate events. So I wonder if it would make sense to lock onChanged (define it as synchronized). One other small hint. I would change the log message |
@Sail-Away thank you a lot for testing and detailed feedback. it good to hear PR improves behaviour. valid point with overlapping restarts and synchronized. |
@Sail-Away |
* quick restart on network changes * only restart if needed * add null check Signed-off-by: Eugen Freiter <freiter@gmx.de>
* quick restart on network changes * only restart if needed * add null check Signed-off-by: Eugen Freiter <freiter@gmx.de> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
* quick restart on network changes * only restart if needed * add null check Signed-off-by: Eugen Freiter <freiter@gmx.de>
* quick restart on network changes * only restart if needed * add null check Signed-off-by: Eugen Freiter <freiter@gmx.de> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
homekit binding makes currently a full restart on network changes like IP address changes.
the full restart includes removing all openhab items from the list of homekit accessories and adding them again. basically, the start/stop methods for binding start/stop were re-used
this could lead in some case to config reset in home all, like reported here
https://community.openhab.org/t/homekit-no-response-error-on-all-openhab-items/118200/172
this PR reduces the stop logic to minimum and especially skip the removal of homekit accessories on stop.
the changes are following:
Signed-off-by: Eugen Freiter freiter@gmx.de