summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-06-04 10:35:47 +0100
committerGitHub <noreply@github.com>2021-06-04 10:35:47 +0100
commitc96ab31dff4abe9e8a09fb2cd3967e799f770b63 (patch)
treec97635231d1e484f6f5f4c9d817a275ca9084f30
parentEnable Prometheus metrics for the jaeger client library (#10112) (diff)
downloadsynapse-c96ab31dff4abe9e8a09fb2cd3967e799f770b63.tar.xz
Limit number of events in a replication request (#10118)
Fixes #9956.
-rw-r--r--changelog.d/10118.bugfix1
-rw-r--r--synapse/handlers/federation.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/changelog.d/10118.bugfix b/changelog.d/10118.bugfix
new file mode 100644
index 0000000000..db62b50e0b
--- /dev/null
+++ b/changelog.d/10118.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.33.0 which caused replication requests to fail when receiving a lot of very large events via federation.
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 49ed7cabcc..f3f97db2fa 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -3056,8 +3056,9 @@ class FederationHandler(BaseHandler):
         """
         instance = self.config.worker.events_shard_config.get_instance(room_id)
         if instance != self._instance_name:
-            # Limit the number of events sent over federation.
-            for batch in batch_iter(event_and_contexts, 1000):
+            # Limit the number of events sent over replication. We choose 200
+            # here as that is what we default to in `max_request_body_size(..)`
+            for batch in batch_iter(event_and_contexts, 200):
                 result = await self._send_events(
                     instance_name=instance,
                     store=self.store,