mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:44:49 -04:00
Fix exceptions when a connection is closed before we read the headers
This fixes bugs introduced in #3700, by making sure that we behave sanely when an incoming connection is closed before the headers are read.
This commit is contained in:
parent
55e6bdf287
commit
be6527325a
2 changed files with 10 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue