-
-
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
[openhabcloud] Reconnect on connection errors #11153
Conversation
According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. [1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Take care, the version is also present in the feature.xml file. |
....openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/internal/CloudClient.java
Outdated
Show resolved
Hide resolved
Thanks for pointing out the lifecycle documentation and addressing this issue! |
Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Signed-off-by: Sami Salonen <ssalonen@gmail.com>
On closer look, However, We can see that in 2.0.1, One way to confirm changed behaviour is to introduce invalid UUID, which is rejected by the server ("not authorized" error). With the new code, client would automatically retry. Old implementation stopped alltogether without retriying. [1] We can see how In One can easily test this by blocking traffic to myopenhab.org, and observing how connection is retried, even though I found it handy to simulate network issues while testing the changes (a bit glitchy as loadbalancer might hand out another ip suddenly): Introducing 5 sec delay to myopenhab.org
Packet loss
Reseting simulations
|
Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Hi @ssalonen is this ready to review and try out ? |
@digitaldan yes, please. No further changes planned at this stage. |
Maybe the review is picked up faster without WIP in the title? |
This should not be merged yet since it requires the other PR. Therefore I am keeping the WIP for safety. |
@ssalonen: |
The awaiting PR is now merged, isn't it? |
thanks @lolodomo for the reminder, i'll take a look. |
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! I have been running this for the last week without issues, thanks for taking the time to dig into this, i also think the additional debug logging will be helpful for troubleshooting.
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
Exactly. Not sure if this PR will fix all the issues but hopefully points us to right direction with any open issues. Btw, I noticed that the socket io client is somewhat old version... I am unsure of these are maintained anymore and if update would be preferable. Unfortunately, this might also imply updating server side... |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/is-home-myopenhab-org-down/130204/7 |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/myopenhab-service-not-working/121711/15 |
* [openhabcloud] reconnect on connection errors According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. [1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Update Socket IO dependency to 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] feature.xml updated also with socket io 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Re-connect manually on error events when not connected Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] less loud logging on retries Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] removing unnecessary conditional in logging Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] javadoc corrections and clarifications Signed-off-by: Sami Salonen <ssalonen@gmail.com> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
* [openhabcloud] reconnect on connection errors According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. [1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Update Socket IO dependency to 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] feature.xml updated also with socket io 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Re-connect manually on error events when not connected Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] less loud logging on retries Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] removing unnecessary conditional in logging Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] javadoc corrections and clarifications Signed-off-by: Sami Salonen <ssalonen@gmail.com> Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
* [openhabcloud] reconnect on connection errors According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. [1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Update Socket IO dependency to 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] feature.xml updated also with socket io 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Re-connect manually on error events when not connected Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] less loud logging on retries Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] removing unnecessary conditional in logging Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] javadoc corrections and clarifications Signed-off-by: Sami Salonen <ssalonen@gmail.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Discussed in openhab#11153 (comment) Signed-off-by: Sami Salonen <ssalonen@gmail.com>
…12429) Discussed in #11153 (comment) Signed-off-by: Sami Salonen <ssalonen@gmail.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
…penhab#12429) Discussed in openhab#11153 (comment) Signed-off-by: Sami Salonen <ssalonen@gmail.com> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
* [openhabcloud] reconnect on connection errors According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. [1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Update Socket IO dependency to 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] feature.xml updated also with socket io 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Re-connect manually on error events when not connected Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] less loud logging on retries Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] removing unnecessary conditional in logging Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] javadoc corrections and clarifications Signed-off-by: Sami Salonen <ssalonen@gmail.com>
* [openhabcloud] reconnect on connection errors According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. [1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Update Socket IO dependency to 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] feature.xml updated also with socket io 1.0.1 Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] Re-connect manually on error events when not connected Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] less loud logging on retries Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] removing unnecessary conditional in logging Signed-off-by: Sami Salonen <ssalonen@gmail.com> * [openhabcloud] javadoc corrections and clarifications Signed-off-by: Sami Salonen <ssalonen@gmail.com>
…penhab#12429) Discussed in openhab#11153 (comment) Signed-off-by: Sami Salonen <ssalonen@gmail.com>
…penhab#12429) Discussed in openhab#11153 (comment) Signed-off-by: Sami Salonen <ssalonen@gmail.com> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
…penhab#12429) Discussed in openhab#11153 (comment) Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Requires openhab/openhab-osgiify#28
Aiming to resolve issues like openhab/openhab-cloud#134 . Common workaround seems to be to restart the bundle, see https://community.openhab.org/t/myopenhab-service-not-working/121711/5 and https://community.openhab.org/t/connection-to-myopenhab-broken/73808/80.
According to documentation (albeit for 2.x Socket IO version) [1], reconnection is responsibility of the user on connect_error events. Indeed, default implementation (1.0.0 and 1.0.1) only tries to reconnect if it is the first time we are connecting... **EDIT: ** please see #11153 (comment) for more discussion how this behaves in socket io 1.x java client.
[1] Lifecycle diagram in https://socketio.github.io/socket.io-client-java/socket_instance.html
Signed-off-by: Sami Salonen ssalonen@gmail.com