summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2021-10-07 12:37:10 +0200
committerGitHub <noreply@github.com>2021-10-07 10:37:10 +0000
commit52aefd50860f9b44f48a9b465d42f26faa4eb84f (patch)
treeac479ca91358e4b0854af520aedcefa4530cbaa1 /synapse/http/server.py
parent`disallow-untyped-defs` for `synapse.state` (#11004) (diff)
downloadsynapse-52aefd50860f9b44f48a9b465d42f26faa4eb84f.tar.xz
Catch AttributeErrors when calling registerProducer (#10995)
Looks like the wrong exception type was caught in #10932.
Diffstat (limited to '')
-rw-r--r--synapse/http/server.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 0df1bfbeef..897ba5e453 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -563,7 +563,10 @@ class _ByteProducer:
 
         try:
             self._request.registerProducer(self, True)
-        except RuntimeError as e:
+        except AttributeError as e:
+            # Calling self._request.registerProducer might raise an AttributeError since
+            # the underlying Twisted code calls self._request.channel.registerProducer,
+            # however self._request.channel will be None if the connection was lost.
             logger.info("Connection disconnected before response was written: %r", e)
 
             # We drop our references to data we'll not use.