home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.73k stars 28.89k forks source link

DD-WRT Read timed out error on startup - dd-wrt/device tracker #104044

Open Anto79-ops opened 7 months ago

Anto79-ops commented 7 months ago

The problem

Hello

I have a LinksysWRT3200AC router running DD-WRT firmware (since July) and with uPnP enabled I also get modem stats. I also use it has a device tracker with the following config.

# Device track for Router
device_tracker:
  - platform: ddwrt
    host: 192.168.1.1
    username: admin
    password: !secret ddwrt
    wireless_only: false

Recently, in the last 2 months, I've noticed that when I restart HA, it takes a while for HA to complete start up (a few minutes untill the it says "Home Assistant has started!" however, it does NOT say that something is blocking HA, it just waits and during this waiting time, this gets logged:

Logger: homeassistant
Source: components/ddwrt/device_tracker.py:146
First occurred: 9:24:35 AM (18 occurrences)
Last logged: 9:27:09 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/response.py", line 444, in _error_catcher
    yield
  File "/usr/local/lib/python3.11/site-packages/urllib3/response.py", line 567, in read
    data = self._fp_read(amt) if not fp_closed else b""
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/response.py", line 533, in _fp_read
    return self._fp.read(amt) if amt is not None else self._fp.read()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/http/client.py", line 466, in read
    s = self.fp.read(amt)
        ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 816, in generate
    yield from self.raw.stream(chunk_size, decode_content=True)
  File "/usr/local/lib/python3.11/site-packages/urllib3/response.py", line 628, in stream
    data = self.read(amt=amt, decode_content=decode_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/response.py", line 566, in read
    with self._error_catcher():
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/urllib3/response.py", line 449, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.1', port=80): Read timed out.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 441, in async_device_tracker_scan
    ) = await hass.async_add_executor_job(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 383, in _load_device_names_and_attributes
    host_name_by_mac[mac] = scanner.get_device_name(mac)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/ddwrt/device_tracker.py", line 89, in get_device_name
    if not (data := self.get_ddwrt_data(url)):
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/ddwrt/device_tracker.py", line 146, in get_ddwrt_data
    response = requests.get(
               ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 747, in send
    r.content
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 899, in content
    self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 822, in generate
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.1', port=80): Read timed out.

While this is happening, the stats for the modem are still being reported (via the uPnP integration).

thanks

What version of Home Assistant Core has the issue?

2023.11.2

What was the last working version of Home Assistant Core?

2023.9.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

DD-WRT

Link to integration documentation on our website

https://www.home-assistant.io/integrations/ddwrt/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 7 months ago

ddwrt documentation ddwrt source

Anto79-ops commented 5 months ago

hi, any one else experiencing this? thanks

Anto79-ops commented 4 months ago

wanted to mention this seems to happen on restart of Host and not Core.

EDIT: This may not be true.

issue-triage-workflows[bot] commented 1 month ago

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 has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Anto79-ops commented 1 month ago

I have not experiecne this issue in about 40 days now since the new and improved core speedups from 2024.4 and .5 releases, but would like to keep this open a bit longer as sometimes it takes that long to show itself again. thanks

Anto79-ops commented 1 month ago

Just wanted to report that it happened a few days ago after rebooting a few times in an hour.