thlucas1 / homeassistantcomponent_soundtouchplus

Home Assistant integration for Bose SoundTouch speakers
MIT License
14 stars 1 forks source link

Websocket Exception never retrieved #19

Closed override80 closed 5 months ago

override80 commented 5 months ago

System Health details

System Information

version core-2024.5.3
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.1.0-18-amd64
arch x86_64
timezone Europe/Rome
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1407 Downloaded Repositories | 94 HACS Data | ok
Home Assistant Supervisor host_os | Debian GNU/Linux 12 (bookworm) -- | -- update_channel | stable supervisor_version | supervisor-2024.05.1 agent_version | 1.4.1 docker_version | 26.0.0 disk_total | 221.9 GB disk_used | 128.3 GB healthy | true supported | true supervisor_api | ok version_api | ok installed_addons | AppDaemon (0.16.5), Home Assistant Google Drive Backup (0.112.1), Let's Encrypt (5.0.18), MariaDB (2.7.1), NGINX Home Assistant SSL proxy (3.9.0), TasmoAdmin (0.30.2), UniFi Network Application (3.0.5), Rhasspy Assistant (2.5.11), OpenVPN Client (0.0.2), Remote API proxy (1.3.0), Music Assistant BETA (2.1.0b0), Hikvision Doorbell (3.0.14), ESPHome (2024.5.0), Prowlarr NAS (nightly-1.17.2.4510-ls197), FlareSolverr (3.3.17), Transmission (4.0.5-3), Radarr (5.4.6.8723-5), Sonarr (4.0.4.1668), Network UPS Tools (0.13.0), Jellyseerr (1.8.1), go2rtc (1.9.1), Frigate (Full Access) (0.13.2), Exadel CompreFace (1.1.0), Double Take (beta) (1.13.1), Portainer (2.20.1), Piper (1.5.0), Whisper (2.0.0), openWakeWord (1.10.0), Cloudflared (5.1.9), Rclone Backup (3.1.0), Jellyfin NAS (10.8.13-3-3), Music Assistant (2.0.4)
Dashboards dashboards | 8 -- | -- resources | 55 views | 29 mode | storage
Recorder oldest_recorder_run | May 8, 2024 at 7:40 PM -- | -- current_recorder_run | May 16, 2024 at 8:15 PM estimated_db_size | 2626.28 MiB database_engine | mysql database_version | 10.11.6
Solcast PV Forecast can_reach_server | ok -- | -- used_requests | 8 rooftop_site_count | 1
Bose SoundTouch Plus integration_version | v1.0.42 -- | -- devices_configured | 4: SoundTouch 20 LivingRoom (SoundTouch 20), SoundTouch 10 Bedroom (SoundTouch 10), SoundTouch 10 Giulio (SoundTouch 10), SoundTouch 10 Gym (SoundTouch 10)
Spotify api_endpoint_reachable | ok -- | --

Checklist

Describe the issue

Hi, I'm seeing sometimes this error in the logs:

2024-05-17 13:29:16.381 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 715, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 682, in _send_frame
    self._write(header + message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 702, in _write
    raise ConnectionResetError("Cannot write to closing transport")ConnectionResetError: Cannot write to closing transport
2024-05-17 13:29:16.420 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aioshelly/rpc_device/wsrpc.py", line 267, in _ping_if_not_closed
    await self._client.ping()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_ws.py", line 157, in ping
    await self._writer.ping(message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 715, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 675, in _send_frame
    self._write(header + mask + message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 702, in _write
    raise ConnectionResetError("Cannot write to closing transport")ConnectionResetError: Cannot write to closing transport
2024-05-17 13:29:16.421 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aioshelly/rpc_device/wsrpc.py", line 267, in _ping_if_not_closed
    await self._client.ping()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_ws.py", line 157, in ping
    await self._writer.ping(message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 715, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 675, in _send_frame
    self._write(header + mask + message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 702, in _write
    raise ConnectionResetError("Cannot write to closing transport")ConnectionResetError: Cannot write to closing transport
2024-05-17 13:29:16.423 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aioshelly/rpc_device/wsrpc.py", line 267, in _ping_if_not_closed
    await self._client.ping()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_ws.py", line 157, in ping
    await self._writer.ping(message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 715, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 675, in _send_frame
    self._write(header + mask + message)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 702, in _write
    raise ConnectionResetError("Cannot write to closing transport")ConnectionResetError: Cannot write to closing transport

It seems that it is happening usually upon automation reload button pressure from devtools.

I don't know if it's a consequence or the cause for home assistant reload (it gets stuck for few seconds, the web ui gets disconnected and I have to wait few seconds and refresh).

What do you think?

Reproduction steps

Don't really know, except for details I gave you

Debug logs

Let me know if you need these

Diagnostics dump

No response

thlucas1 commented 5 months ago

Not sure on this one. It seems like it has something to do with an async IO request, and a tcp connection that was forcibly closed while it was trying to send data or waiting for a response (e.g. ConnectionResetError: Cannot write to closing transport). Something to do with a ping request maybe?

Do you think this is an issue with the SoundTouchPlus integration? I would think it would list something in the exception trace relating to soundtouchplus if the integration were at fault.

override80 commented 5 months ago

I have no idea @thlucas1. I was just wondering if it ever happened to you. For some reasons sometimes my home assistant just hangs (mostly when saving automations edited from the UI) and after 10s it reloads and i see this popping up in the log. Something bad is happening in the backend but no logs at all. I was just wondering if it ever happened to you while working on the integration, but most probably it's a consequence (something in the backend reloads and this leads to the websocket connection being terminated).

thlucas1 commented 5 months ago

@override80 I have not seen anything like that in my logs before. However, I remember an HA update a few months ago that indicated PING support was being moved to UI configuration mode. I remember I had to remove my ping automation definitions from configuration.yaml, as they are now configured in the UI. You might take a look at you configuration.yaml (and any *.yaml's refernced from within) for any PING definitions.

Other than that, I am at a loss on what to recommend.

Hope it helps!

override80 commented 5 months ago

Hi @thlucas1 , thanks for the provided info. I'll keep digging into it, i'll keep you posted if i can sort it out!

Thnaks!