Openhab cloud connection stops working, does not try to reconnect

FYI, there’s maintenance tomorrow (January 29), so it is expected that there will be disconnections.

2 Likes

Yes, see my post in How to automatically restart cloud connector after an unexpected disconnection - #26 by digitaldan

Hopefully this helps with reconnects that get into a zombie state.

3 Likes

@digitaldan First, thank you for all your great work around openHAB.

I don’t want to play the party pooper, but I fear changes due to myopenHAB maintenance broke my openHAB installation that now it does not reconnect any more since January 30th.
By the way - no changes of my openHAB installation by my own since weeks.

I checked all my logs and this are the results of my research:

  • Every night shortly past 3am openHAB Cloud service is disconnected because my router performs an internet reconnect to prevent a provider forced disconnect.
  • After internet reconnect a few seconds later openHAB Cloud service connection was performed automatically – until January 29th.
  • Since January 30th no openHAB Cloud service reconnection was established automatically, so every morning I must restart openHAB manually to get openHAB Cloud service connection working.

See also my logs for details:

2023-01-29 03:24:20.174 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = 2a3780fd-69ad-4e96-b5b8-69ed849xxxxx, base URL = http://localhost:8080)
2023-01-29 03:24:22.075 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = 2a3780fd-69ad-4e96-b5b8-69ed849xxxxx, base URL = http://localhost:8080)
…
2023-01-30 03:23:09.889 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = 2a3780fd-69ad-4e96-b5b8-69ed849xxxxx, base URL = http://localhost:8080)

=> No automated openHAB Cloud service reconnect since January 30th!

I saw the workaround described in the blog How to automatically restart cloud connector after an unexpected disconnection, but please be aware I’m still using openHAB 2.5 version.

Is there a chance to have back myopenHAB functionality in a way that the openHAB Cloud service reconnect is performed automatically – without workarounds?

Since you know it’s going to happen every day at that specific time, you don’t need to test the connection. You just need:

  • A single Exec thing/item with the console command to restart the binding.
    • openhab-cli console -p habopen bundle:restart org.openhab.io.openhabcloud
    • Don’t forget to add the command to your whitelist (per the tutorial)
  • A rule that turns the Exec item ON once a day.
    • I suggest 4:00am to ensure that the router has restarted and your Internet access has been fully restored.

It’s still a workaround, but it should keep you going until there’s a proper fix.

1 Like

So, there is an issue in the cloud connector bundle that would not reconnect to the service when the server specifically disconnects the client (which is now more common) . I suspect this is the issue. This is fixed in the next 3.4 release and also in the upcoming 4.0 release. As you are on 2.5, we don’t have a way of back porting this fix. I agree with @rpwong that manually restarting the binding shortly after your router restart is the best bet until you can upgrade to a supported OH version.

2 Likes

@andyzle: Off topic, but if you need more reason to upgrade, note that OH2.5 is subject to the Log4Shell vulnerability that was discovered in 2021. It was patched in OH3.2.

2 Likes

I will implement the scheduled binding restart, thank you.

@digitaldan Thank you for having a look on my issue.

Off topic too - In fact I started playing around with OH 3.2 in January 2022 to set up my openHAB installation from scratch as recommended by some experienced OH users. But after 4 month I lost all my developed content when my USB disk crashed totally due to my fault, only to backup openHAB content with its backup script storing my configuration in a zip file locally, not on a separated device. After that incident I was searching for a new backup environment (my old one is an outdated NAS). Due to other private activities I did not complete this search until now, but after closing that subject I will definitely start with OH 3.4.

Is there still no fix?

Only a workaround - see above comment from @rpwong.

Well there was this recently on server side: Disconnected from the openHAB Cloud service - #115 by rpwong

Further improvements in upcoming OH release as well to reconnection behaviour How to automatically restart cloud connector after an unexpected disconnection - #30 by digitaldan ([openhabcloud] Reconnection Fixes by digitaldan · Pull Request #14251 · openhab/openhab-addons · GitHub)

Is the server side fix making a difference?

So there is still a race conditional on the server that happens under load that can cause a zombie connection to happen. Unfortunately our cloud provider Linode just had “Emergency” network maintenance and caused such an event to happen :frowning: . I have a fix in mind for this, which will involve upgrading our DB software and expose some helpful functionality for this. I’m planning on doing that before the month end, so hopefully that will alleviate the last of these issues.

7 Likes

We should have a discord server for when these maintenance tasks are happening for us to join you and share some of the effort :slight_smile: hope to see this issue fixed once and all soon, thank you for all of the hard work you guys have been putting onto this.