summary refs log tree commit diff
path: root/synapse/http/site.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-08-21 03:47:52 +1000
committerGitHub <noreply@github.com>2018-08-21 03:47:52 +1000
commit23d7e63a4abbdc19694099902c03b6b7c5144df4 (patch)
treee4c65afdc782c62f8993a4b7343b5e7437a15d45 /synapse/http/site.py
parentchangelog (diff)
parentchangelog (diff)
downloadsynapse-23d7e63a4abbdc19694099902c03b6b7c5144df4.tar.xz
Merge pull request #3723 from matrix-org/rav/fix_logcontext_disaster
Fix exceptions when a connection is closed before we read the headers
Diffstat (limited to 'synapse/http/site.py')
-rw-r--r--synapse/http/site.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py

index ad2a98468e..88ed3714f9 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py
@@ -182,7 +182,7 @@ class SynapseRequest(Request): # the client disconnects. with PreserveLoggingContext(self.logcontext): logger.warn( - "Error processing request: %s %s", reason.type, reason.value, + "Error processing request %r: %s %s", self, reason.type, reason.value, ) if not self._is_processing: @@ -219,6 +219,12 @@ class SynapseRequest(Request): """Log the completion of this request and update the metrics """ + if self.logcontext is None: + # this can happen if the connection closed before we read the + # headers (so render was never called). In that case we'll already + # have logged a warning, so just bail out. + return + usage = self.logcontext.get_resource_usage() if self._processing_finished_time is None: