From 36da382af3106fb39c6c8ba3bd6e0607cc72d80a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 6 May 2025 20:33:05 +0200 Subject: [PATCH] Handle ClientPayloadError in advanced logging (#5869) When the systemd-journal-gatewayd service is being shutdown while Supervisor is still trying to read logs, aiohttp throws a ClientPayloadError, presumably because we try to read until the next linefeed, which aiohttp cannot satisfy anymore. Simply catch the exception just like the connection reset errors previously in #5358 and #5715. --- supervisor/api/host.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/supervisor/api/host.py b/supervisor/api/host.py index 631989e41..fdf80a462 100644 --- a/supervisor/api/host.py +++ b/supervisor/api/host.py @@ -5,7 +5,7 @@ from contextlib import suppress import logging from typing import Any -from aiohttp import ClientConnectionResetError, web +from aiohttp import ClientConnectionResetError, ClientPayloadError, web from aiohttp.hdrs import ACCEPT, RANGE import voluptuous as vol from voluptuous.error import CoerceInvalid @@ -269,7 +269,8 @@ class APIHost(CoreSysAttributes): err, ) break - except ConnectionResetError as ex: + except (ConnectionResetError, ClientPayloadError) as ex: + # ClientPayloadError is most likely caused by the closing the connection raise APIError( "Connection reset when trying to fetch data from systemd-journald." ) from ex