diff options
author | Erik Johnston <erikj@jki.re> | 2019-02-25 19:17:22 +0000 |
---|---|---|
committer | Amber Brown <hawkowl@atleastfornow.net> | 2019-02-25 11:17:22 -0800 |
commit | 899a119c2bc2ad9885efcf3f3958aec1cdccb464 (patch) | |
tree | 0e810f5eddc0ea1fe93059a6a7d5104d11530b09 /synapse/rest/media | |
parent | Fix ACME config for python 2. (#4717) (diff) | |
download | synapse-899a119c2bc2ad9885efcf3f3958aec1cdccb464.tar.xz |
Don't log stack trace when client has gone away during media download (#4738)
* Don't log stack trace when client has gone away during media download * Newsfile * Fixup newsfile
Diffstat (limited to 'synapse/rest/media')
-rw-r--r-- | synapse/rest/media/v1/_base.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/_base.py b/synapse/rest/media/v1/_base.py index efe42a429d..d16a30acd8 100644 --- a/synapse/rest/media/v1/_base.py +++ b/synapse/rest/media/v1/_base.py @@ -133,8 +133,15 @@ def respond_with_responder(request, responder, media_type, file_size, upload_nam logger.debug("Responding to media request with responder %s") add_file_headers(request, media_type, file_size, upload_name) - with responder: - yield responder.write_to_consumer(request) + try: + with responder: + yield responder.write_to_consumer(request) + except Exception as e: + # The majority of the time this will be due to the client having gone + # away. Unfortunately, Twisted simply throws a generic exception at us + # in that case. + logger.warning("Failed to write to consumer: %s %s", type(e), e) + finish_request(request) |