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
71.15k stars 29.83k forks source link

Aiohttp.server crashes #49021

Closed prilly-dev closed 3 years ago

prilly-dev commented 3 years ago

The problem

I have some weird behavior after upgrading to 2021.04.x version of HA, i am running docker.

webserver of ha stops working after random time, its slow and fails alot.

see log of aiohttp.server failing

What is version of Home Assistant Core has the issue?

2021.4.x

What was the last working version of Home Assistant Core?

2021.3.x

What type of installation are you running?

Home Assistant Container

Integration causing the issue

No response

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-04-10 14:43:56 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1152, in _sendfile_fallback
    read = await self.run_in_executor(None, file.readinto, view)
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 485, in start
    resp, reset = await task
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 440, in _handle_request
    reset = await self.finish_response(request, resp, start_time)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 591, in finish_response
    await prepare_meth(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 241, in prepare
    return await self._sendfile(request, fobj, offset, count)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 96, in _sendfile
    await loop.sendfile(transport, fobj, offset, count)
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1131, in sendfile
    return await self._sendfile_fallback(transport, file,
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1161, in _sendfile_fallback
    await proto.restore()
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 263, in restore
    self._transport.resume_reading()
  File "/usr/local/lib/python3.8/asyncio/sslproto.py", line 344, in resume_reading
    self._ssl_protocol._transport.resume_reading()
AttributeError: 'NoneType' object has no attribute 'resume_reading'
2021-04-10 14:52:38 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139842581709728] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds

2021-04-10 21:40:14 ERROR (MainThread) [homeassistant.components.system_health] Error fetching system info for cloud - can_reach_cloud
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/system_health/__init__.py", line 214, in async_check_can_reach_url
    await session.get(url, timeout=5)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 619, in _request
    break
  File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2021-04-10 21:40:14 ERROR (MainThread) [homeassistant.components.system_health] Error fetching system info for cloud - can_reach_cloud_auth
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/system_health/__init__.py", line 214, in async_check_can_reach_url
    await session.get(url, timeout=5)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 619, in _request
    break
  File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2021-04-10 21:40:14 ERROR (MainThread) [homeassistant.components.system_health] Error fetching system info for easee - reach_easee_cloud
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/system_health/__init__.py", line 214, in async_check_can_reach_url
    await session.get(url, timeout=5)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 619, in _request
    break
  File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2021-04-10 21:40:14 ERROR (MainThread) [homeassistant.components.system_health] Error fetching system info for cloud - can_reach_cert_server
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/system_health/__init__.py", line 214, in async_check_can_reach_url
    await session.get(url, timeout=5)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 619, in _request
    break
  File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
prilly-dev commented 3 years ago

I am still seeing issues related to aiohttp i think, gui stops responding, seems like webserver stops working.

`2021-04-16 19:07:41 ERROR (MainThread) [aiohttp.server] Unhandled exception Traceback (most recent call last): File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1152, in _sendfile_fallback read = await self.run_in_executor(None, file.readinto, view) asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 485, in start resp, reset = await task File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 440, in _handle_request reset = await self.finish_response(request, resp, start_time) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 591, in finish_response await prepare_meth(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 241, in prepare return await self._sendfile(request, fobj, offset, count) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 96, in _sendfile await loop.sendfile(transport, fobj, offset, count) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1131, in sendfile return await self._sendfile_fallback(transport, file, File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1161, in _sendfile_fallback await proto.restore() File "/usr/local/lib/python3.8/asyncio/base_events.py", line 263, in restore self._transport.resume_reading() File "/usr/local/lib/python3.8/asyncio/sslproto.py", line 344, in resume_reading self._ssl_protocol._transport.resume_reading() AttributeError: 'NoneType' object has no attribute 'resume_reading' `

github-actions[bot] commented 3 years 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.