summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2022-01-20 17:04:54 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2022-01-20 17:42:01 +0000
commit20fc57683cd178711c44fe90f2355b653013c00a (patch)
tree552dac5d22059da1967d03f369b7f7256519dea9
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
downloadsynapse-github/anoa/log_exceptions_async_json.tar.xz
log exceptions in _async_write_json_to_request_in_thread github/anoa/log_exceptions_async_json anoa/log_exceptions_async_json
-rw-r--r--synapse/http/server.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 09b4125489..42eba19b54 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -776,7 +776,11 @@ async def _async_write_json_to_request_in_thread(
 
     with start_active_span("encode_json_response"):
         span = active_span()
-        json_str = await defer_to_thread(request.reactor, encode, span)
+        try:
+            json_str = await defer_to_thread(request.reactor, encode, span)
+        except Exception:
+            logger.exception("failed to encode json response")
+            return
 
     _write_bytes_to_request(request, json_str)