From 1371d5b798dc308bef8b0adbf3229919981fafa4 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 12:24:48 +0000 Subject: [PATCH 1/4] Don't log stack traces for HTTP error responses --- synapse/federation/transaction_queue.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py index 4640513497..fe787abaeb 100644 --- a/synapse/federation/transaction_queue.py +++ b/synapse/federation/transaction_queue.py @@ -522,8 +522,13 @@ class TransactionQueue(object): ) except FederationDeniedError as e: logger.info(e) + except HttpResponseException as e: + logger.warning( + "TX [%s] Received %d response to transaction: %s", + destination, e.code, e, + ) except RequestSendFailed as e: - logger.warning("(TX [%s] Failed to send transaction: %s", destination, e) + logger.warning("TX [%s] Failed to send transaction: %s", destination, e) for p, _ in pending_pdus: logger.info("Failed to send event %s to %s", p.event_id, From 83c50bf7521fe9cb7442b9b51f3e1ae0a855bc89 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 12:26:16 +0000 Subject: [PATCH 2/4] Newsfile --- changelog.d/4361.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4361.misc diff --git a/changelog.d/4361.misc b/changelog.d/4361.misc new file mode 100644 index 0000000000..020dacb547 --- /dev/null +++ b/changelog.d/4361.misc @@ -0,0 +1 @@ +Add better logging for unexpected errors while sending transactions From d422570e9bac0a00d50c62d423479ad9b0250c03 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 14:22:18 +0000 Subject: [PATCH 3/4] Use RequestSendFailed when fail to parse content type headers --- synapse/http/matrixfederationclient.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 7a2b4f0957..be4076fc6a 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -823,21 +823,21 @@ def check_content_type_is_json(headers): headers (twisted.web.http_headers.Headers): headers to check Raises: - RuntimeError if the + RequestSendFailed: if the Content-Type header is missing or isn't JSON """ c_type = headers.getRawHeaders(b"Content-Type") if c_type is None: - raise RuntimeError( + raise RequestSendFailed(RuntimeError( "No Content-Type header" - ) + ), can_retry=False) c_type = c_type[0].decode('ascii') # only the first header val, options = cgi.parse_header(c_type) if val != "application/json": - raise RuntimeError( + raise RequestSendFailed(RuntimeError( "Content-Type not application/json: was '%s'" % c_type - ) + ), can_retry=False) def encode_query_args(args): From d91b99abe062579fd8afe90bf02e018ca57e96d5 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 14:24:05 +0000 Subject: [PATCH 4/4] Newsfile --- changelog.d/4362.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4362.misc diff --git a/changelog.d/4362.misc b/changelog.d/4362.misc new file mode 100644 index 0000000000..020dacb547 --- /dev/null +++ b/changelog.d/4362.misc @@ -0,0 +1 @@ +Add better logging for unexpected errors while sending transactions