From 010753a0a7da4590d40079c2f329c0736368f819 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mar 21 2022 17:43:05 +0000 Subject: log content-length when we get an error reading request Fixes https://pagure.io/koji/issue/3288 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index f487443..d86874f 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -15369,10 +15369,12 @@ def handle_upload(environ): str_e = str(e) logger.error(f"Error reading upload. Offset {offset}+{size}, path {fn}") if 'timeout' in str_e: - logger.exception("Timed out reading input stream") + logger.exception("Timed out reading input stream. " + f"Content-Length: {context.environ.get('CONTENT_LENGTH')}") raise RequestTimeout(str_e) else: - logger.exception("Error reading input stream") + logger.exception("Error reading input stream. " + f"Content-Length: {context.environ.get('CONTENT_LENGTH')}") raise BadRequest(str_e) if not chunk: break diff --git a/hub/kojixmlrpc.py b/hub/kojixmlrpc.py index f7aaf3d..fa96976 100644 --- a/hub/kojixmlrpc.py +++ b/hub/kojixmlrpc.py @@ -219,10 +219,12 @@ class ModXMLRPCRequestHandler(object): except OSError as e: str_e = str(e) if 'timeout' in str_e: - self.logger.exception("Timed out reading input stream") + self.logger.exception("Timed out reading input stream. " + f"Content-Length: {context.environ.get('CONTENT_LENGTH')}") raise RequestTimeout(str_e) else: - self.logger.exception("Error reading input stream") + self.logger.exception("Error reading input stream. " + f"Content-Length: {context.environ.get('CONTENT_LENGTH')}") raise BadRequest(str_e) if not chunk: break