summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-01-04 16:31:32 +0000
committerGitHub <noreply@github.com>2022-01-04 16:31:32 +0000
commit878aa5529399ece8fbb68674a6de86d6958bacae (patch)
tree67f19ff07959dd6f23edbeea1f391d614293660f
parentRemove redundant `get_current_events_token` (#11643) (diff)
downloadsynapse-878aa5529399ece8fbb68674a6de86d6958bacae.tar.xz
`FederationClient.backfill`: stop flagging events as outliers (#11632)
Events returned by `backfill` should not be flagged as outliers.

Fixes:

```
AssertionError: null
  File "synapse/handlers/federation.py", line 313, in try_backfill
    dom, room_id, limit=100, extremities=extremities
  File "synapse/handlers/federation_event.py", line 517, in backfill
    await self._process_pulled_events(dest, events, backfilled=True)
  File "synapse/handlers/federation_event.py", line 642, in _process_pulled_events
    await self._process_pulled_event(origin, ev, backfilled=backfilled)
  File "synapse/handlers/federation_event.py", line 669, in _process_pulled_event
    assert not event.internal_metadata.is_outlier()
```

See https://sentry.matrix.org/sentry/synapse-matrixorg/issues/231992

Fixes #8894.
-rw-r--r--changelog.d/11632.bugfix1
-rw-r--r--synapse/federation/federation_client.py2
-rw-r--r--synapse/handlers/federation_event.py4
3 files changed, 5 insertions, 2 deletions
diff --git a/changelog.d/11632.bugfix b/changelog.d/11632.bugfix
new file mode 100644
index 0000000000..c73d41652a
--- /dev/null
+++ b/changelog.d/11632.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.19.3 which could sometimes cause `AssertionError`s when backfilling rooms over federation.
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py
index fee1477ab6..7353c2b6b1 100644
--- a/synapse/federation/federation_client.py
+++ b/synapse/federation/federation_client.py
@@ -272,7 +272,7 @@ class FederationClient(FederationBase):
 
         # Check signatures and hash of pdus, removing any from the list that fail checks
         pdus[:] = await self._check_sigs_and_hash_and_fetch(
-            dest, pdus, outlier=True, room_version=room_version
+            dest, pdus, room_version=room_version
         )
 
         return pdus
diff --git a/synapse/handlers/federation_event.py b/synapse/handlers/federation_event.py
index d08e48da58..7c81e3651f 100644
--- a/synapse/handlers/federation_event.py
+++ b/synapse/handlers/federation_event.py
@@ -666,7 +666,9 @@ class FederationEventHandler:
         logger.info("Processing pulled event %s", event)
 
         # these should not be outliers.
-        assert not event.internal_metadata.is_outlier()
+        assert (
+            not event.internal_metadata.is_outlier()
+        ), "pulled event unexpectedly flagged as outlier"
 
         event_id = event.event_id