From 4f35759fe3fe9f5c54a9c29efddab88d1ab52cca Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 20 May 2025 17:04:25 +0200 Subject: [PATCH] Stop reading advanced logs on ConnectionError (#5900) * Stop reading advanced logs on ConnectionError If the client side connection closes with a `ConnectionError`, stop reading the advanced logs. This is very similar to ClientConnectionResetError which is easily reproducable by having a log open and following in the browser and then restaring Home Assistant. So far I wans't able to artificaially reproduce the ConnectionError, but there are quite some reports on Sentry so it seems to happen in real world. * Warn on ConnectionError --- supervisor/api/host.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/supervisor/api/host.py b/supervisor/api/host.py index fdf80a462..129b1da7a 100644 --- a/supervisor/api/host.py +++ b/supervisor/api/host.py @@ -269,6 +269,13 @@ class APIHost(CoreSysAttributes): err, ) break + except ConnectionError as err: + _LOGGER.warning( + "%s raised when returning journal logs: %s", + type(err).__name__, + err, + ) + break except (ConnectionResetError, ClientPayloadError) as ex: # ClientPayloadError is most likely caused by the closing the connection raise APIError(