summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2019-04-25 02:37:33 +1000
committerRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-04-24 17:37:32 +0100
commit6b2b9a58c44c9c2f7efc45e8b588cde17fcdb0d4 (patch)
tree73b2573de3ee90b2ab6f88cfb4651887d6c9128b
parentMerge pull request #5077 from matrix-org/babolivier/account_expiration (diff)
downloadsynapse-6b2b9a58c44c9c2f7efc45e8b588cde17fcdb0d4.tar.xz
Prevent "producer not unregistered" message (#5009)
-rw-r--r--changelog.d/5009.bugfix1
-rw-r--r--synapse/rest/media/v1/_base.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/changelog.d/5009.bugfix b/changelog.d/5009.bugfix
new file mode 100644
index 0000000000..e66d3dd1aa
--- /dev/null
+++ b/changelog.d/5009.bugfix
@@ -0,0 +1 @@
+Clients timing out/disappearing while downloading from the media repository will now no longer log a spurious "Producer was not unregistered" message.
\ No newline at end of file
diff --git a/synapse/rest/media/v1/_base.py b/synapse/rest/media/v1/_base.py
index e2b5df701d..2dcc8f74d6 100644
--- a/synapse/rest/media/v1/_base.py
+++ b/synapse/rest/media/v1/_base.py
@@ -191,6 +191,10 @@ def respond_with_responder(request, responder, media_type, file_size, upload_nam
         # in that case.
         logger.warning("Failed to write to consumer: %s %s", type(e), e)
 
+        # Unregister the producer, if it has one, so Twisted doesn't complain
+        if request.producer:
+            request.unregisterProducer()
+
     finish_request(request)