Skip to content
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

[influxdb] persistence service does not recover from connection loss after UnknownHostException #16233

Closed
kaistierl opened this issue Jan 7, 2024 · 4 comments · Fixed by #16234
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@kaistierl
Copy link

kaistierl commented Jan 7, 2024

Expected Behavior

When the InfluxDB gets unavailable for a short time during operation, OpenHAB recovers from this condition and continues to write data as soon as InfluxDB is available again. This should work in a dockerized setup, where the InfluxDB container is stopped, and started again a few seconds later.

Current Behavior

When the InfluxDB container is stopped and started again during operation of OpenHAB, OpenHAB completely stops writing data and does not recover. It throws a UnknownHostException after the InfluxDB container was stopped and seems not to recover the connection once the InfluxDB would be available again.

There is a Connection lost, trying re-connection message but even after some minutes, there is still no database status is OK message in the logs. Therefore, I suspect the reconnection logic to not work properly here.

To recover from this, I need to manually run a bundle:restart of the InfluxDB persistence service. Then it works again and it even writes queued data from the "lost" minutes.

Here is a log, I cut it right before the bundle:restart

openhab_influx_connection_lost.log

persistence service config:

version=V1
url=http://influxdb:8086
user=admin
password=''
db=openhab
retentionPolicy=autogen

Steps to Reproduce (for Bugs)

  1. Setup influxDB and OpenHAB in docker containers, with a shared docker network between those. Configure OpenHAB to address the InfluxDB by it's container name using docker based name resolution (i.e. use url=http://influxdb:8086 with the InfluxDB container named influxdb).
  2. Stop the InfluxDB container, wait a few seconds, then start it again.

Your Environment

  • Version used: OpenHAB 4.1.0 with InfluxDB 1.8.10, both in docker containers (Official images from Docker Hub)
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Buster, ...): Host runs on Debian 12
@kaistierl kaistierl added the bug An unexpected problem or unintended behavior of an add-on label Jan 7, 2024
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 7, 2024
Fixes openhab#16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 7, 2024
Fixes openhab#16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 7, 2024
Fixes openhab#16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur
Copy link
Contributor

jlaur commented Jan 7, 2024

@kaistierl - can you try this: org.openhab.persistence.influxdb-4.2.0-SNAPSHOT.jar

Although it's named 4.2, it should work with 4.1. Please uninstall the bundled version before dropping this to your addons directory.

@jlaur
Copy link
Contributor

jlaur commented Jan 9, 2024

@kaistierl - can you verifiy the provided fix?

@kaistierl
Copy link
Author

kaistierl commented Jan 9, 2024

Will do but have been too busy the last days. Will be able to test on friday latest.

Anyway, thanks for the fast attempt to fix this! :)

@kaistierl
Copy link
Author

kaistierl commented Jan 12, 2024

I was now able to verify the fix and can confirm that it works in my case. In the DEBUG log I now see several reconnection tries and as soon as InfluxDB is available again, the reconnection succeeds.

lolodomo pushed a commit that referenced this issue Jan 13, 2024
Fixes #16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
AntonJansen pushed a commit to AntonJansen/openhab-addons that referenced this issue Jan 13, 2024
Fixes openhab#16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
jlaur added a commit that referenced this issue Jan 14, 2024
Fixes #16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Jan 27, 2024
Fixes openhab#16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
austvik pushed a commit to austvik/openhab-addons that referenced this issue Mar 27, 2024
Fixes openhab#16233

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants