This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Always close _all_ ijson coroutines, even if doing so raises Exceptions#14065
Merged
DMRobertson merged 5 commits intodevelopfrom Oct 6, 2022
Merged
Always close _all_ ijson coroutines, even if doing so raises Exceptions#14065DMRobertson merged 5 commits intodevelopfrom
ijson coroutines, even if doing so raises Exceptions#14065DMRobertson merged 5 commits intodevelopfrom
Conversation
ijson coroutines, even if doing so raises Exceptions
Contributor
|
Thanks for picking this up! |
DMRobertson
commented
Oct 5, 2022
Comment on lines
+994
to
+996
| raise ExceptionBundle( | ||
| f"There were {len(exceptions)} errors closing coroutines", exceptions | ||
| ) from exceptions[0] |
Contributor
Author
There was a problem hiding this comment.
Not promising this is the cleanest way to do it---there are no tracebacks for exceptions[1:]---but this seemed Good Enough.
Contributor
Author
There was a problem hiding this comment.
(I'm not sure what @richvdh meant by exception chanining in #13293 (comment) ---something along these lines?)
DMRobertson
commented
Oct 5, 2022
Comment on lines
+205
to
+206
| parts.append(str(e)) | ||
| super().__init__("\n - ".join(parts)) |
Contributor
Author
There was a problem hiding this comment.
I'm specifically trying to ensure each exception's summary is included here, even if we don't have their tracebacks.
There are some comments in the description elaborating on why I didn't want to use the backport here,
reivilibre
approved these changes
Oct 6, 2022
Contributor
reivilibre
left a comment
There was a problem hiding this comment.
Seems good to me, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13293. Improves on #12875 and #9958.
This change means that we should raise one Sentry event for each such failure to
.finish()a parser, instead of an event for each line printed to stderr.I have only included the first traceback
exceptions[0]: I'm assuming that's enough to diagnose what happened if we see this error. I do make sure to include thestr()of each individual exception though.I considered using https://pypi.org/project/exceptiongroup/ but this was a little scary: it mentions patching TracebackException and adding exception hooks; I feared that this wouldn't play nicely with twisted + logcontexts + other arcanery in Synapse I don't grok.