summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-07-20 14:24:25 +0100
committerGitHub <noreply@github.com>2021-07-20 14:24:25 +0100
commit54389d5697622f1beffaeda96d9c6da7ef7d93a9 (patch)
tree8e557666edbca114d09fbd002a1d8510644792d3 /synapse/storage/databases
parentCombine some changelog lines in the documentation section (diff)
downloadsynapse-54389d5697622f1beffaeda96d9c6da7ef7d93a9.tar.xz
Fix dropping locks on shut down (#10433)
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r--synapse/storage/databases/main/lock.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/lock.py b/synapse/storage/databases/main/lock.py
index 774861074c..3d1dff660b 100644
--- a/synapse/storage/databases/main/lock.py
+++ b/synapse/storage/databases/main/lock.py
@@ -78,7 +78,11 @@ class LockStore(SQLBaseStore):
         """Called when the server is shutting down"""
         logger.info("Dropping held locks due to shutdown")
 
-        for (lock_name, lock_key), token in self._live_tokens.items():
+        # We need to take a copy of the tokens dict as dropping the locks will
+        # cause the dictionary to change.
+        tokens = dict(self._live_tokens)
+
+        for (lock_name, lock_key), token in tokens.items():
             await self._drop_lock(lock_name, lock_key, token)
 
         logger.info("Dropped locks due to shutdown")