From 8fb66bcf18228b97205d92d612e97054ca23cc21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Tue, 4 Mar 2025 10:08:44 +0100 Subject: [PATCH] Stop streaming logs when client closes connection (#5722) When connection is closed by the client, the journal_logs_reader generator still returns new lines, trying to write each one of them to the closed transport. With debug logging enabled, this can end up in an endless loop. To fix that, break out of the loop immediately after the connection is reset. --- supervisor/api/host.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/api/host.py b/supervisor/api/host.py index 7a6488f74..bd6eb2d0d 100644 --- a/supervisor/api/host.py +++ b/supervisor/api/host.py @@ -270,6 +270,7 @@ class APIHost(CoreSysAttributes): "ClientConnectionResetError raised when returning journal logs: %s", err, ) + break except ConnectionResetError as ex: raise APIError( "Connection reset when trying to fetch data from systemd-journald."