(MainThread) [aiohttp.server] Unhandled exception

Hello guys,
i’ve noticed that i’m receiving this error when HA restarts, not everytime. Didn’t noticed before but i don’t know when he comes up for the first time. Everything is working fine to be honest, but i want to know what is raising this error:

2021-01-17 13:55:07 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'
3 Likes

same at my installation. Since i have updated to 2021.1.3. Now I am on 2021.1.4. After 1 day runtime my installation is not reachable. After a restart it seems ok to the next day :frowning:

Cheers

I have got the exact error message and would like to know the reason too!

1 Like

The same error :frowning: but only from my PC. The loggin is successful from my phone and other PC in local and online.

Anyone found a solution?

Same issue here, running 2021.2.3. My system is running fine as far as I can tell. Only other issue I am having is Lovelace fails to update periodically though I have no idea if this is related, or not.

Seems pretty common but none have idea of what this problem is…

Got the same issue. Someone got to have the solution? :innocent:

Same…HA 2021.3.3
Everything appears to be operating.

Suggestions?

same problem.

core-2021.3.4
supervisor-2021.03.6

It occurs when the browser is refreshed (f.e. Chrome, Opera, …)

2021-03-19 16:16:17 ERROR (MainThread) [frontend.js.latest.202103026] https://homeassistant.local:8123/lovelace/default_view:0:0 Uncaught 
2021-03-19 16:16:17 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'

Same problem here. On RPI4

Almost the same for me

core-2021.5.2
OS 5.13

2021-05-11 12:55:44 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-05-11 12:55:45 ERROR (MainThread) [frontend.js.latest.202105040]

same problem here UI is unreachable, but google assistant still works:
core-2021.5.3
supervisor-2021.04.3

Did you ever figure out a solution to this?!

I have a very similar error happening a lot. mine is Python 3.9.
Tracking down errors in the log files is really tough. No references.

Had the same issue… but I was able to pin-point the exact time when it happened. I left my PC logged into HA which went into standby mode. I was on the /hassio/system page (Supervisor > System > Log Provider: Core) After I came back, I just refreshed the page (Ctr-F5). That’s when I got the following error:

2022-02-03 18:45:39 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1183, 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.9/site-packages/aiohttp/web_protocol.py", line 514, in start
    resp, reset = await task
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 460, in _handle_request
    reset = await self.finish_response(request, resp, start_time)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 613, in finish_response
    await prepare_meth(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_fileresponse.py", line 286, in prepare
    return await self._sendfile(request, fobj, offset, count)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_fileresponse.py", line 99, in _sendfile
    await loop.sendfile(transport, fobj, offset, count)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1162, in sendfile
    return await self._sendfile_fallback(transport, file,
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1192, in _sendfile_fallback
    await proto.restore()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 263, in restore
    self._transport.resume_reading()
  File "/usr/local/lib/python3.9/asyncio/sslproto.py", line 343, in resume_reading
    self._ssl_protocol._transport.resume_reading()
AttributeError: 'NoneType' object has no attribute 'resume_reading'

(My HA is running inside VM on a NAS.)

Hope this helps to troubleshoot the error…

Hi,
I know this is old but if anyone has this error if you use duckdns with self signed cert
and you access the device via the ip or homeassistant.local. You will get this error because it is not a valid cert cause it is signed to something else like https ://yoururl.duckdns.org:8123

1 Like