mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 16:23:51 +01:00
Workaround for failure to wrap reason in Failure (#7473)
This commit is contained in:
parent
eafd103fc7
commit
5611644519
2 changed files with 8 additions and 0 deletions
1
changelog.d/7473.bugfix
Normal file
1
changelog.d/7473.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Workaround for an upstream Twisted bug that caused Synapse to become unresponsive after startup.
|
|
@ -15,6 +15,7 @@ import contextlib
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from twisted.python.failure import Failure
|
||||||
from twisted.web.server import Request, Site
|
from twisted.web.server import Request, Site
|
||||||
|
|
||||||
from synapse.http import redact_uri
|
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
|
Overrides twisted.web.server.Request.connectionLost to record the finish time and
|
||||||
do logging.
|
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()
|
self.finish_time = time.time()
|
||||||
Request.connectionLost(self, reason)
|
Request.connectionLost(self, reason)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue