homeassistant-satellite icon indicating copy to clipboard operation
homeassistant-satellite copied to clipboard

ConnectionResetError: Cannot write to closing transport.

Open j3mu5 opened this issue 1 year ago • 6 comments

Hello,

the installation under the latest version of Raspberry Pi OS (Raspbian GNU/Linux 12 bookworm) worked smoothly. An installation of the service also worked well. However, the satelite seems to stop responding after some time. With journalctl -u homeassistant-satellite.service -f I see that the log is flooded with the following message:

ConnectionResetError: Cannot write to closing transport.

Is it better to switch to docker?

j3mu5 avatar Oct 16 '23 18:10 j3mu5

/python3.11/site-packages/aiohttp/client_ws.py:153> exception=ConnectionResetError('Cannot write to closing transport')> Oct 17 08:05:39 raspberrypi run[9439]: Traceback (most recent call last): Oct 17 08:05:39 raspberrypi run[9439]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.11/site-packages/aiohttp/client_ws.py", line 156, in send_bytes Oct 17 08:05:39 raspberrypi run[9439]: await self._writer.send(data, binary=True, compress=compress) Oct 17 08:05:39 raspberrypi run[9439]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 688, in send Oct 17 08:05:39 raspberrypi run[9439]: await self._send_frame(message, WSMsgType.BINARY, compress) Oct 17 08:05:39 raspberrypi run[9439]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 601, in _send_frame Oct 17 08:05:39 raspberrypi run[9439]: raise ConnectionResetError("Cannot write to closing transport") Oct 17 08:05:39 raspberrypi run[9439]: ConnectionResetError: Cannot write to closing transport Oct 17 08:05:39 raspberrypi run[9439]: ERROR:asyncio:Task exception was never retrieved Oct 17 08:05:39 raspberrypi run[9439]: future: <Task finished name='Task-2862522' coro=<ClientWebSocketResponse.send_bytes() done, defined at /home/pi/homeassistant-satellite/.venv/lib

rollyfx avatar Oct 17 '23 07:10 rollyfx

Same problem here and also very annoying that speaker keep making sound and i have to reboot rasperry pi with connected speaker to it otherwise it will keep playing sound

Emile86 avatar Oct 24 '23 23:10 Emile86

Same issue with docker, happens (f.ex.) after a restart of Home Assistant.

Although a graceful reconnect would certainly be the best solution, even crashing the container would help, since docker can be configured to restart the container in that case, same with f.ex. systemd.

markusressel avatar Oct 28 '23 12:10 markusressel

Yes, the satellite does not survive a homeassistant restart and keeps spamming the following error:

ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-22736879' coro=<ClientWebSocketResponse.send_bytes() done, defined at /nix/store/p1i55pqyplhbiy476vac7f5060k85ki0-python3.11-aiohttp-3.8.5/lib/python3.11/site-packages/aiohttp/client_ws.py:153> exception=ConnectionResetError('Cannot write to closing transport')>
Traceback (most recent call last):
  File "/nix/store/p1i55pqyplhbiy476vac7f5060k85ki0-python3.11-aiohttp-3.8.5/lib/python3.11/site-packages/aiohttp/client_ws.py", line 156, in send_bytes
    await self._writer.send(data, binary=True, compress=compress)
  File "/nix/store/p1i55pqyplhbiy476vac7f5060k85ki0-python3.11-aiohttp-3.8.5/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 688, in send
    await self._send_frame(message, WSMsgType.BINARY, compress)
  File "/nix/store/p1i55pqyplhbiy476vac7f5060k85ki0-python3.11-aiohttp-3.8.5/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

mweinelt avatar Oct 30 '23 13:10 mweinelt

I don't know maybe it's just me but after home assistant goes online again satelliet keeps giving error and after a while also home assistant voice assistant crashes and doesn't react anymore even locally with text conversation.

The way to repair is to stop satellite script and restart home assistant

Still investigating it

Emile86 avatar Oct 30 '23 14:10 Emile86

Restarting the satellite once Home Assistant is back up restores functionality for me.

mweinelt avatar Oct 30 '23 14:10 mweinelt