Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 52aefd5

Browse files
authored
Catch AttributeErrors when calling registerProducer (#10995)
Looks like the wrong exception type was caught in #10932.
1 parent f563676 commit 52aefd5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

changelog.d/10995.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Correct a bugfix introduced in Synapse v1.44.0 that wouldn't catch every error of the connection breaks before a response could be written to it.

synapse/http/server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,10 @@ def __init__(
563563

564564
try:
565565
self._request.registerProducer(self, True)
566-
except RuntimeError as e:
566+
except AttributeError as e:
567+
# Calling self._request.registerProducer might raise an AttributeError since
568+
# the underlying Twisted code calls self._request.channel.registerProducer,
569+
# however self._request.channel will be None if the connection was lost.
567570
logger.info("Connection disconnected before response was written: %r", e)
568571

569572
# We drop our references to data we'll not use.

0 commit comments

Comments
 (0)