diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-05-14 17:07:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 17:07:24 +0100 |
commit | 5611644519e623a98ad38295eed8f95f78303a3e (patch) | |
tree | 5534c29336205f6ed6ebac486b517931b4fd5916 | |
parent | Fix b'GET' in prometheus metrics (#7503) (diff) | |
download | synapse-5611644519e623a98ad38295eed8f95f78303a3e.tar.xz |
Workaround for failure to wrap reason in Failure (#7473)
-rw-r--r-- | changelog.d/7473.bugfix | 1 | ||||
-rw-r--r-- | synapse/http/site.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/changelog.d/7473.bugfix b/changelog.d/7473.bugfix new file mode 100644 index 0000000000..8c9510f5e3 --- /dev/null +++ b/changelog.d/7473.bugfix @@ -0,0 +1 @@ +Workaround for an upstream Twisted bug that caused Synapse to become unresponsive after startup. \ No newline at end of file diff --git a/synapse/http/site.py b/synapse/http/site.py index 32feb0d968..514f2f1402 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py @@ -15,6 +15,7 @@ import contextlib import logging import time +from twisted.python.failure import Failure from twisted.web.server import Request, Site from synapse.http import redact_uri @@ -190,6 +191,12 @@ class SynapseRequest(Request): Overrides twisted.web.server.Request.connectionLost to record the finish time and do logging. """ + # There is a bug in Twisted where reason is not wrapped in a Failure object + # Detect this and wrap it manually as a workaround + # More information: https://github.com/matrix-org/synapse/issues/7441 + if not isinstance(reason, Failure): + reason = Failure(reason) + self.finish_time = time.time() Request.connectionLost(self, reason) |