supervisor icon indicating copy to clipboard operation
supervisor copied to clipboard

Ingress dies [ConnectionResetError: Cannot write to closing transport]

Open philbert opened this issue 6 months ago • 6 comments

Describe the issue you are experiencing

For a very long time on my setup (maybe 1 year+) ingress has been dying 2-3 times per month. The problem has migrated with my setup from a RPI4 4GB with SD card, to RPI4 4GB with SSD, to an Intel N100 with 16GB.

After ingress from the supervisor dies, HA still appears to run correctly, but all add-ons become unavailable. The only way to resolve the problem is to ssh to the host and run ha supervisor restart or to restart the host OS from the GUI.

The problem seems to begin with the supervisor encountering ConnectionResetError: Cannot write to closing transport. This error occurs 22 times in the log file, and then HA is restarted. However when HA comes up again the supervisor seems to fail to establish contact with it as the supervisor log continually repeats the error Timeout on call http://172.30.32.1:8123/api/core/state

supervisor-2024-08-14.log

From what I can tell in the HA log, everything appears ok except for one odd thing that I can't explain which is that this message from HA: s6-rc: info: service legacy-services: stopping at 18:48:58.033 occurs before the supervisor log message: [supervisor.docker.manager] Restarting homeassistant at 18:49:35.445. This oddity is quite a bit after the initial problems that the supervisor encountered, so I'm inclined not to read too much into it.

ha-2024-08-14.log

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Steps to reproduce the issue

  1. Unknown :(

Anything in the Supervisor logs that might be useful for us?

[31m2024-08-13 18:44:54.294 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 189, in block_bad_requests
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 205, in system_validation
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 224, in token_validation
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 283, in core_proxy
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/ingress.py", line 161, in handler
    return await self._handle_websocket(request, addon, path, session_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/ingress.py", line 190, in _handle_websocket
    await ws_server.prepare(request)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_ws.py", line 152, in prepare
    payload_writer = await super().prepare(request)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_response.py", line 417, in prepare
    return await self._start(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_response.py", line 425, in _start
    await self._write_headers()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_response.py", line 505, in _write_headers
    await writer.write_headers(status_line, self._headers)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_writer.py", line 130, in write_headers
    self._write(buf)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_writer.py", line 75, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport[0m

System Health information

There are currently no repairs available

Supervisor diagnostics

config_entry-hassio-a7a964f4381b8f813b47cd58b792c395.json

Additional information

No response

philbert avatar Aug 14 '24 10:08 philbert