From 279738c305d5281ac90bbaa114851b50d7665426 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 26 Sep 2025 13:28:47 -0700 Subject: [PATCH] actions: Raise an exception if privileged server response is empty - These situation occur when server encounters an error when trying to formulate a response. All exceptions during execution of actions are caught and reported properly. However, server may encounter errors during processing of exception raised in an action. Or may die abruptly. This special error will make identifying such situations easier. Tests: - Add a 'return' after _read_request() in privileged_daemon.py:RequestHandler:handle(). This will trigger this error. Starting FreedomBox service will show these errors as 'ConnectionError: Server returned empty response'. Similarly running 'freedombox-cmd --no-args plinth is_package_manager_busy' will show the same error. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/actions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/actions.py b/plinth/actions.py index d045c4000..0e75fc0f4 100644 --- a/plinth/actions.py +++ b/plinth/actions.py @@ -88,6 +88,9 @@ def _read_from_server(client_socket: socket.socket) -> bytes: response += chunk + if not response: + raise ConnectionError('Server returned empty response') + return json.loads(response)