summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-02-14 13:52:03 +0000
committerErik Johnston <erik@matrix.org>2018-02-15 09:51:09 +0000
commit5e2d0650dfcf26c2f8d818c521f85c23818d8e3e (patch)
treed3c3adf106e5a5e5ddc98ba2cbb75526bb56f1dc
parentLimit concurrent AS joins (diff)
downloadsynapse-5e2d0650dfcf26c2f8d818c521f85c23818d8e3e.tar.xz
Handle exceptions in get_hosts_for_room when sending events over federation
-rw-r--r--synapse/federation/transaction_queue.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py
index a141ec9953..12e8df9cc6 100644
--- a/synapse/federation/transaction_queue.py
+++ b/synapse/federation/transaction_queue.py
@@ -184,17 +184,22 @@ class TransactionQueue(object):
                     if not is_mine and send_on_behalf_of is None:
                         continue
 
-                    # Get the state from before the event.
-                    # We need to make sure that this is the state from before
-                    # the event and not from after it.
-                    # Otherwise if the last member on a server in a room is
-                    # banned then it won't receive the event because it won't
-                    # be in the room after the ban.
-                    destinations = yield self.state.get_current_hosts_in_room(
-                        event.room_id, latest_event_ids=[
-                            prev_id for prev_id, _ in event.prev_events
-                        ],
-                    )
+                    try:
+                        # Get the state from before the event.
+                        # We need to make sure that this is the state from before
+                        # the event and not from after it.
+                        # Otherwise if the last member on a server in a room is
+                        # banned then it won't receive the event because it won't
+                        # be in the room after the ban.
+                        destinations = yield self.state.get_current_hosts_in_room(
+                            event.room_id, latest_event_ids=[
+                                prev_id for prev_id, _ in event.prev_events
+                            ],
+                        )
+                    except Exception:
+                        logger.exception("Failed to calculate hosts in room")
+                        continue
+
                     destinations = set(destinations)
 
                     if send_on_behalf_of is not None: