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

Fix long-standing bug where ReadWriteLock could drop logging contexts #10993

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10993.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug where `ReadWriteLock`s could drop logging contexts on exit.
6 changes: 4 additions & 2 deletions synapse/util/async_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ def _ctx_manager():
try:
yield
finally:
new_defer.callback(None)
with PreserveLoggingContext():
new_defer.callback(None)
self.key_to_current_readers.get(key, set()).discard(new_defer)

return _ctx_manager()
Expand Down Expand Up @@ -466,7 +467,8 @@ def _ctx_manager():
try:
yield
finally:
new_defer.callback(None)
with PreserveLoggingContext():
new_defer.callback(None)
if self.key_to_current_writer[key] == new_defer:
self.key_to_current_writer.pop(key)

Expand Down