From ecdfbbf3594d77ffdcf8c0179e7ea36bc2876e26 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 16 Jun 2022 17:02:28 +0930 Subject: [PATCH] connectd: restore gossip filter aging. When we moved gossip filtering to connectd, this aging got lost. Without this, we hit the 10,000 entry limit before expiring full gossip anti-echo cache. This is under 1M in allocations per peer, but in DEVELOPER mode each allocation includes adds 3 notifiers (32 bytes each) and a backtrace child (40 + 40 + 256 bytes), making it almost 10MB per peer, plus allocation overhead. Signed-off-by: Rusty Russell Changelog-Fixed: connectd: large memory usage with many peers fixed. --- connectd/multiplex.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connectd/multiplex.c b/connectd/multiplex.c index 54740a7b3..1f50ab683 100644 --- a/connectd/multiplex.c +++ b/connectd/multiplex.c @@ -344,6 +344,9 @@ static struct io_plan *encrypt_and_send(struct peer *peer, /* Kicks off write_to_peer() to look for more gossip to send from store */ static void wake_gossip(struct peer *peer) { + /* Don't remember sent per-peer gossip forever. */ + gossip_rcvd_filter_age(peer->gs.grf); + peer->gs.active = IFDEV(!peer->daemon->dev_suppress_gossip, true); io_wake(peer->peer_outq);