diff options
author | Matthew Hodgson <matthew@matrix.org> | 2017-10-03 10:26:42 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2017-10-03 10:26:42 +0100 |
commit | 1b44b67a7f59de782cdf8c232d5e115a1de64b16 (patch) | |
tree | ce7bc2715bce7c734f923abfac99ab88f90be04d | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-matthew/ignore-rogue-events.tar.xz |
ignore rogue events from rooms we have left github/matthew/ignore-rogue-events matthew/ignore-rogue-events
stops explosions of event search when a confused server sends us events for a room we've actually left
-rw-r--r-- | synapse/handlers/federation.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 18f87cad67..5bed141d07 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -125,6 +125,23 @@ class FederationHandler(BaseHandler): self.room_queues[pdu.room_id].append((pdu, origin)) return + # Otherwise we're not joining the room, and so if we don't think we're + # in the room, ditch the packet entirely. + # + # This stops a chain reaction of requesting missing events when we receive + # a rogue event over federation for a room we are no longer participating in, + # which empirically can take 20 minutes and acquire the linearise lock + # for receiving PDUs for that room for the whole duration - e.g. + # https://matrix.org/~matthew/train-wreck.log + is_in_room = yield self.auth.check_host_in_room( + pdu.room_id, + self.server_name + ) + if not is_in_room: + logger.info("Ignoring PDU %s for room %s from %s as not in room!", + pdu.event_id, pdu.room_id, origin) + return + state = None auth_chain = [] |