mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 23:44:57 -04:00
Fix edge case where a Linearizer
could get stuck (#12358)
Just after a task acquires a contended `Linearizer` lock, it sleeps. If the task is cancelled during this sleep, we need to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
parent
31c1209c50
commit
79e7c2c426
3 changed files with 53 additions and 5 deletions
|
@ -453,7 +453,11 @@ class Linearizer:
|
|||
#
|
||||
# This needs to happen while we hold the lock. We could put it on the
|
||||
# exit path, but that would slow down the uncontended case.
|
||||
await self._clock.sleep(0)
|
||||
try:
|
||||
await self._clock.sleep(0)
|
||||
except CancelledError:
|
||||
self._release_lock(key, entry)
|
||||
raise
|
||||
|
||||
return entry
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue