summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-08 18:05:35 +0100
committerErik Johnston <erik@matrix.org>2021-04-08 18:05:35 +0100
commitbe0e722fe1296aadac4771e75c73fd96ae350689 (patch)
treeea8f46bd7f51600e8193b92b7aa2e0629be2dc93
parentPut opencontainers labels to the final image (#9765) (diff)
parentFix sharded federation sender sometimes using 100% CPU. (diff)
downloadsynapse-be0e722fe1296aadac4771e75c73fd96ae350689.tar.xz
Merge branch 'erikj/fix_stalled_catchup' into develop
-rw-r--r--changelog.d/9770.bugfix1
-rw-r--r--synapse/federation/sender/__init__.py6
2 files changed, 5 insertions, 2 deletions
diff --git a/changelog.d/9770.bugfix b/changelog.d/9770.bugfix
new file mode 100644

index 0000000000..baf93138de --- /dev/null +++ b/changelog.d/9770.bugfix
@@ -0,0 +1 @@ +Fix bug where sharded federation senders could get stuck repeatedly querying the DB in a loop, using lots of CPU. diff --git a/synapse/federation/sender/__init__.py b/synapse/federation/sender/__init__.py
index 98bfce22ff..d821dcbf6a 100644 --- a/synapse/federation/sender/__init__.py +++ b/synapse/federation/sender/__init__.py
@@ -734,16 +734,18 @@ class FederationSender(AbstractFederationSender): self._catchup_after_startup_timer = None break + last_processed = destinations_to_wake[-1] + destinations_to_wake = [ d for d in destinations_to_wake if self._federation_shard_config.should_handle(self._instance_name, d) ] - for last_processed in destinations_to_wake: + for destination in destinations_to_wake: logger.info( "Destination %s has outstanding catch-up, waking up.", last_processed, ) - self.wake_destination(last_processed) + self.wake_destination(destination) await self.clock.sleep(CATCH_UP_STARTUP_INTERVAL_SEC)