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

Fix exception responding to request that has been closed #10932

Merged
merged 2 commits into from
Sep 28, 2021

Conversation

erikjohnston
Copy link
Member

Introduced in #10905

It's a bit icky, but a) matches what we do when we call .finish(), and b) there isn't a more specific exception class really as the problem is that it raises an AttributeError. The alternative is to check if request.channel is still set, but that seems a bit brittle

c.f. https://sentry.matrix.org/sentry/synapse-matrixorg/issues/231719/events/b3e541e6016d43f3a584f986d07bc132/

@erikjohnston erikjohnston requested a review from a team September 28, 2021 13:09
Comment on lines +572 to +574
else:
# Start producing if `registerProducer` was successful
self.resumeProducing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this in an else clause rather than in the try one ooc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't think resumeProducing should throw so we don't want to accidentally swallow exceptions if it does fail. This is especially true since we're catching RuntimeError which is really broad.

@erikjohnston erikjohnston changed the base branch from develop to release-v1.44 September 28, 2021 13:19
@erikjohnston erikjohnston merged commit 37bb93d into release-v1.44 Sep 28, 2021
@erikjohnston erikjohnston deleted the erikj/fix_json_bytes branch September 28, 2021 13:36
erikjohnston added a commit that referenced this pull request Sep 28, 2021
babolivier added a commit that referenced this pull request Oct 7, 2021
Looks like the wrong exception type was caught in #10932.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants