From 31c79d5b34422d033531fcaee343cffa4e42475a Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 26 Apr 2022 15:00:36 +0100 Subject: [PATCH 1/2] Comment out dodgy `log_kv` Mitigation for #12552. --- synapse/handlers/device.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index 3c0fc756d46b..319836da2bee 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -683,9 +683,12 @@ async def _handle_new_device_update_async(self) -> None: self.federation_sender.send_device_messages( host, immediate=False ) - log_kv( - {"message": "sent device update to host", "host": host} - ) + # TODO: when called, this isn't in a logging context. + # This leads to log spam, sentry event spam, and massive + # memory usage. See #12552. + # log_kv( + # {"message": "sent device update to host", "host": host} + # ) if current_stream_id != stream_id: # Clear the set of hosts we've already sent to as we're From fb5ced47707f812c4374bbf367ad8844aad55c1e Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 26 Apr 2022 15:05:11 +0100 Subject: [PATCH 2/2] Changelog --- changelog.d/12554.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/12554.bugfix diff --git a/changelog.d/12554.bugfix b/changelog.d/12554.bugfix new file mode 100644 index 000000000000..48c1146db52b --- /dev/null +++ b/changelog.d/12554.bugfix @@ -0,0 +1 @@ +Fix a bug introduced in Synapse 1.58.0rc1 where the main process could consume excessive amounts of CPU and memory handling sentry logging failures.