This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
synapse/federation/sender Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ Fix a memory leak by limiting the length of time that messages will be queued for a remote server that has been unreachable.
Original file line number Diff line number Diff line change @@ -337,6 +337,28 @@ async def _transaction_transmission_loop(self) -> None:
337
337
(e .retry_last_ts + e .retry_interval ) / 1000.0
338
338
),
339
339
)
340
+
341
+ if e .retry_interval > 60 * 60 * 1000 :
342
+ # we won't retry for another hour!
343
+ # (this suggests a significant outage)
344
+ # We drop pending PDUs and EDUs because otherwise they will
345
+ # rack up indefinitely.
346
+ # Note that:
347
+ # - the EDUs that are being dropped here are those that we can
348
+ # afford to drop (specifically, only typing notifications,
349
+ # read receipts and presence updates are being dropped here)
350
+ # - Other EDUs such as to_device messages are queued with a
351
+ # different mechanism
352
+ # - this is all volatile state that would be lost if the
353
+ # federation sender restarted anyway
354
+
355
+ # dropping read receipts is a bit sad but should be solved
356
+ # through another mechanism, because this is all volatile!
357
+ self ._pending_pdus = []
358
+ self ._pending_edus = []
359
+ self ._pending_edus_keyed = {}
360
+ self ._pending_presence = {}
361
+ self ._pending_rrs = {}
340
362
except FederationDeniedError as e :
341
363
logger .info (e )
342
364
except HttpResponseException as e :
You can’t perform that action at this time.
0 commit comments