Skip to content

Commit 36da382

Browse files
authored
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.
1 parent 85f8107 commit 36da382

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

supervisor/api/host.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
from typing import Any
77

8-
from aiohttp import ClientConnectionResetError, web
8+
from aiohttp import ClientConnectionResetError, ClientPayloadError, web
99
from aiohttp.hdrs import ACCEPT, RANGE
1010
import voluptuous as vol
1111
from voluptuous.error import CoerceInvalid
@@ -269,7 +269,8 @@ async def advanced_logs_handler(
269269
err,
270270
)
271271
break
272-
except ConnectionResetError as ex:
272+
except (ConnectionResetError, ClientPayloadError) as ex:
273+
# ClientPayloadError is most likely caused by the closing the connection
273274
raise APIError(
274275
"Connection reset when trying to fetch data from systemd-journald."
275276
) from ex

0 commit comments

Comments
 (0)