H.A. and RPI4 totally frozen if browser/mobile app is left open for a while

First of all forgive me for my bad english. I’m experiencing a very strange issue. I run Home assistant on a RPI4. Since i decided to use an old phone with the H.A. app always open to display some informations i realized that after a while the RPI completely crashes. I can’t even ping my machine on the network.
I tested the interface trough web from my computers and if I leave the page open after a while the same thing happen. Every time i refresh a page I also get an error in the Core section of the supervisor log.
This is what i get:

2021-06-08 19:29:20 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-06-08 19:29:23 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'

It would be great if somebody can share any knowledge about this issue, I’m moving to algeria in a few days for work and basically H.A. is controlling 99% of my house. My wife is a geek but she’s not gonna like it if I don’t fix it…

Go to the profile page (circle icon low left side menu) on the always on device and turn off the “automatically close the connection” switch and see if that helps.

There’s also this issue open:

Thank you @tom_l I will test this in the morning and come back to you.

No improvements yet. Still investigating. Any idea?