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

Workaround for failure to wrap reason in Failure #7473

Merged
merged 2 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7473.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Workaround for an upstream Twisted bug that caused Synapse to become unresponsive after startup.
7 changes: 7 additions & 0 deletions synapse/http/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import logging
import time

from twisted.python.failure import Failure
from twisted.web.server import Request, Site

from synapse.http import redact_uri
Expand Down Expand Up @@ -190,6 +191,12 @@ def connectionLost(self, reason):
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)

Expand Down