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 does not work properly after reboot #18094

Closed
petersohn opened this issue Nov 1, 2018 · 10 comments
Closed

Influxdb does not work properly after reboot #18094

petersohn opened this issue Nov 1, 2018 · 10 comments

Comments

@petersohn
Copy link

Home Assistant release with the issue:
0.81.2
Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):
Raspberry Pi
Component/platform:
Influxdb

Description of problem:
I am using Home Assistant from Raspberry Pi. When I boot the machine, Hass starts up, but I get a warning on the FE that the Influxdb component failed to initialize. After restarting Hass, it works.

My theory is that it can be because Hass starts before the network is set up, and if Influxdb cannot be initialized at first try, then it gives up instead of retrying later.

@kennedyshead
Copy link
Contributor

This is not a Homeassistant bug, try changing the boot order.

@petersohn
Copy link
Author

That may help, but it's still a bug. What if the network is simply down at the time the device boots? For example, after a power outage, the Raspberry Pi boots faster than the router (which is the case for me), or simply the internet connection is down, or the Influxdb server is temporarily down, then Home Assistant should retry connecting once it comes up. It should not require a Hass restart. For other kinds of errors, such as an authentication error, it is reasonable to give up, as that is unlikely to be fixed automatically. But a connection error often does get fixed.

@DubhAd
Copy link
Contributor

DubhAd commented Dec 28, 2018

On the "should retry" note. I was trying out InfluxDB on 0.84.6 yesterday. When I restarted the InfluxDB service, Home Assistant logged a failure of the connection, and then never retried the connection. Until I restarted Home Assistant 20 minutes later, no new data arrived in InfluxDB.

@birddogsc
Copy link

Is this still an issue you are experiencing? Can you please try upgrading to the latest version of Home Assistant (0.90) and report back if this is still a problem? Thanks!

@Tjeerdw
Copy link

Tjeerdw commented Mar 24, 2019

I have updated today to 0.90.1 and can confirm this is still an issue. Once every 20 reboots InfluxDB works here. any help with this is greatly appreciated.

@stickystyle
Copy link

looks like this is being worked on in #22567

@mkarnebeek
Copy link

Doesn't seem to be resolved by #22567, as i'm running 0.93.1, and it has the same issue

Error while setting up platform influxdb
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 181, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa2fc809b70>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.2.89', port=8086): Max retries exceeded with url: /query?q=SHOW+SERIES+LIMIT+1%3B&db=home_assistant (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa2fc809b70>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/influxdb/sensor.py", line 74, in setup_platform
    sensor = InfluxSensor(hass, influx_conf, query)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/influxdb/sensor.py", line 108, in __init__
    influx.query("SHOW SERIES LIMIT 1;")
  File "/usr/local/lib/python3.7/site-packages/influxdb/client.py", line 416, in query
    expected_response_code=expected_response_code
  File "/usr/local/lib/python3.7/site-packages/influxdb/client.py", line 267, in request
    timeout=self._timeout
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.2.89', port=8086): Max retries exceeded with url: /query?q=SHOW+SERIES+LIMIT+1%3B&db=home_assistant (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa2fc809b70>: Failed to establish a new connection: [Errno 111] Connection refused'))

See https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/influxdb/sensor.py#L108

Both in master and dev it looks the same. It seems the PR was reverted?

@stale
Copy link

stale bot commented Aug 19, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 19, 2019
@mkarnebeek
Copy link

This still occurs for me on the latest version 0.97.2

@stale
Copy link

stale bot commented Nov 17, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 17, 2019
@stale stale bot closed this as completed Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants