-
Notifications
You must be signed in to change notification settings - Fork 522
Fix lost logcontext when using timeout_deferred(...)
#19090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5eea20a
6be53d8
9478194
33776c0
4b9441e
630792c
73080af
5179ea3
202906e
0325f97
18ae299
a31eadd
71d490c
8328e1f
140bb59
9aa4919
7bb2ffc
4e576b7
a782d04
3100b63
0308e6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix lost logcontext warnings from timeouts in sync and requests made by Synapse itself. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -808,7 +808,8 @@ def time_it_out() -> None: | |
| timed_out[0] = True | ||
|
|
||
| try: | ||
| deferred.cancel() | ||
| with PreserveLoggingContext(): | ||
| deferred.cancel() | ||
|
Comment on lines
+811
to
+812
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the main fix! See the Deferred callbacks section of our logcontext docs for more info (specifically using solution 2). Heads-up, I wrote the docs too so it's my assumptions/understanding all the way down. Apply your own scrutiny.
Comment on lines
+811
to
+812
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In an ideal world, I think it should be possible to call the deferred callback/errbacks/cancel with some logcontext. I spent too much time trying to figure out the intricacies here and trying to use solution 3 from the Deferred callbacks docs but wasn't successful. It makes me question if what I wrote there is correct in the first place 🤔 The problem is that calling I can't tell if the problem is a) our function just isn't following logcontext rules (and how to resolve that well) or b) we should Instead of banging my head against this more, I've opted to go for the simple route
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I somewhat understand the problem, but don't really understand it enough to give you an answer here. If you ever want to jump on a call to try and talk this through (or even rubber-duck it with me) shout and I'd be happy to :) |
||
| except Exception: # if we throw any exception it'll break time outs | ||
| logger.exception("Canceller failed during timeout") | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.