summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-04-10 10:39:54 +0100
committerErik Johnston <erik@matrix.org>2019-04-10 10:39:54 +0100
commitc132c8e505acd567dac9ae23019b4dc1c763e41c (patch)
tree0f71ee797d3e5552de5d0816a1a10e39b2f2b2c1 /synapse/handlers
parentFix disappearing exceptions in manhole. (#5035) (diff)
downloadsynapse-c132c8e505acd567dac9ae23019b4dc1c763e41c.tar.xz
Handle the case of `get_missing_events` failing
Currently if a call to `/get_missing_events` fails we log an exception
and stop processing the top level event we received over federation.
Instead let's try and handle it sensibly given it is a somewhat expected
failure mode.
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/federation.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 0684778882..07a5dc182d 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -35,6 +35,7 @@ from synapse.api.errors import (
     CodeMessageException,
     FederationDeniedError,
     FederationError,
+    RequestSendFailed,
     StoreError,
     SynapseError,
 )
@@ -493,15 +494,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 for %s: %s",
+                room_id, event_id, e,
+            )
+            return
 
         logger.info(
             "[%s %s]: Got %d prev_events: %s",