From d456ae9e24d682cdc6b9d4ede225c17a5128209e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 2 Sep 2021 14:36:20 +0100 Subject: [PATCH 1/3] Fix bug with reusing 'txn' when persisting event. This will only happen when a server has multiple out of band membership events in a single room. --- synapse/storage/databases/main/events.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index 40b53274fb3d..096ae2878863 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -575,7 +575,13 @@ def _add_chain_cover_index( missing_auth_chains.clear() - for auth_id, event_type, state_key, chain_id, sequence_number in txn: + for ( + auth_id, + event_type, + state_key, + chain_id, + sequence_number, + ) in txn.fetchall(): event_to_types[auth_id] = (event_type, state_key) if chain_id is None: From 0248bec41b35e23c1ab96ab7cf83dfee61ab91cd Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 2 Sep 2021 14:38:43 +0100 Subject: [PATCH 2/3] Newsfile --- changelog.d/10743.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/10743.bugfix diff --git a/changelog.d/10743.bugfix b/changelog.d/10743.bugfix new file mode 100644 index 000000000000..1f978499aeeb --- /dev/null +++ b/changelog.d/10743.bugfix @@ -0,0 +1 @@ +Fix joining room when the server has received multiple invites for different users in the room. From 009d54b8c3e62094910efb5d2d9e1ca993c879a0 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 2 Sep 2021 14:57:00 +0100 Subject: [PATCH 3/3] Newsfile --- changelog.d/10743.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/10743.bugfix b/changelog.d/10743.bugfix index 1f978499aeeb..d597a19870c2 100644 --- a/changelog.d/10743.bugfix +++ b/changelog.d/10743.bugfix @@ -1 +1 @@ -Fix joining room when the server has received multiple invites for different users in the room. +Fix edge case when persisting events into a room where there are multiple events we previously hadn't calculated auth chains for (and hadn't marked as needing to be calculated).