summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-19 13:20:09 +0100
committerGitHub <noreply@github.com>2019-06-19 13:20:09 +0100
commit7dcf984075cbc36e0c9bbd199bf4e4de99523224 (patch)
tree0b15aa2ce80e3836964932871318ceed26480214
parentMerge pull request #5480 from matrix-org/erikj/extremities_dummy_events (diff)
parentFix logline (diff)
downloadsynapse-7dcf984075cbc36e0c9bbd199bf4e4de99523224.tar.xz
Merge pull request #5042 from matrix-org/erikj/fix_get_missing_events_error
Handle the case of `get_missing_events` failing
-rw-r--r--changelog.d/5042.bugfix1
-rw-r--r--synapse/handlers/federation.py28
2 files changed, 20 insertions, 9 deletions
diff --git a/changelog.d/5042.bugfix b/changelog.d/5042.bugfix
new file mode 100644
index 0000000000..736b07c790
--- /dev/null
+++ b/changelog.d/5042.bugfix
@@ -0,0 +1 @@
+Fix bug processing incoming events over federation if call to `/get_missing_events` fails.
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 51d7eb274b..d5a605d3bd 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -498,15 +498,25 @@ class FederationHandler(BaseHandler):
         #
         # All that said: Let's try increasing the timout to 60s and see what happens.
 
-        missing_events = yield self.federation_client.get_missing_events(
-            origin,
-            room_id,
-            earliest_events_ids=list(latest),
-            latest_events=[pdu],
-            limit=10,
-            min_depth=min_depth,
-            timeout=60000,
-        )
+        try:
+            missing_events = yield self.federation_client.get_missing_events(
+                origin,
+                room_id,
+                earliest_events_ids=list(latest),
+                latest_events=[pdu],
+                limit=10,
+                min_depth=min_depth,
+                timeout=60000,
+            )
+        except RequestSendFailed as e:
+            # We failed to get the missing events, but since we need to handle
+            # the case of `get_missing_events` not returning the necessary
+            # events anyway, it is safe to simply log the error and continue.
+            logger.warn(
+                "[%s %s]: Failed to get prev_events: %s",
+                room_id, event_id, e,
+            )
+            return
 
         logger.info(
             "[%s %s]: Got %d prev_events: %s",