Skip to content

Conversation

TheBlueMatt
Copy link
Collaborator

In 686a586 we stopped punishing peers for slowly draining the gossip forwarding buffer, delaying responding to our ping message. While that change was nice on its own, it also now allows us to be a bit more flexible with what enters the gossip_broadcast_buffer.

Because we now do not count pending messages in
gossip_broadcast_buffer against the peer's ping-response timer, there's no reason to continue to limit it based on messages_sent_since_pong. Thus, we drop that restriction here.

However, in practice, the reason for the vast majority of gossip forwarding drops on my node is the 24-message total queue limit, rather than the messages_sent_since_pong limit. This limit was set to bend over backwards trying to avoid counting message buffer sizes while keeping peer message buffers small.

In practice, there is really no reason to do that - summing the capacity of tens of buffers is negligible cost and allows us to be much more flexible with how many messages we queue.

Here we do so, limiting the total outbound message buffer size before gossip forwards are dropped to 128 KiB per peer, rather than 24 messages. In practice, this appears to almost entirely remove gossip forward drops on my node.

@TheBlueMatt TheBlueMatt added this to the 0.2 milestone Sep 19, 2025
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Sep 19, 2025

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link

codecov bot commented Sep 19, 2025

Codecov Report

❌ Patch coverage is 98.52941% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.68%. Comparing base (0d59d73) to head (8f3775d).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/peer_handler.rs 98.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4096      +/-   ##
==========================================
- Coverage   88.69%   88.68%   -0.01%     
==========================================
  Files         176      176              
  Lines      132859   132893      +34     
  Branches   132859   132893      +34     
==========================================
+ Hits       117836   117853      +17     
- Misses      12336    12348      +12     
- Partials     2687     2692       +5     
Flag Coverage Δ
fuzzing 21.55% <0.00%> (-0.01%) ⬇️
tests 88.52% <98.52%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TheBlueMatt TheBlueMatt force-pushed the 2025-09-limt-gossip-by-size branch from 0afa343 to 8e58fa5 Compare September 19, 2025 14:35
@tnull tnull self-requested a review September 20, 2025 18:26
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull @tankyleo! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limiting the total outbound message buffer size before gossip forwards are dropped to 128 KiB per peer

Want to note that this change might make less of a difference once we look into message padding, as size might scale ~linerly with the number of messages then (at least if we really go ahead with MTU-size padding).

@TheBlueMatt
Copy link
Collaborator Author

Want to note that this change might make less of a difference once we look into message padding, as size might scale ~linerly with the number of messages then (at least if we really go ahead with MTU-size padding).

Should still make a big difference as we aren't considering max-size messages but rather MTU-sized messages.

@TheBlueMatt TheBlueMatt requested a review from tnull September 22, 2025 13:57
Copy link
Contributor

@tankyleo tankyleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm looks like CI is failing still on this one cargo test --no-default-features gossip_flood_pause, looked around briefly couldn't find the root cause

@TheBlueMatt
Copy link
Collaborator Author

Good CI #4107

If we're doing gossip backfill to a peer, we first forward all our
`channel_announcement`s and `channel_update`s in SCID-order. While
doing so, we don't forward any fresh `channel_update` messages for
any channels which we haven't yet backfilled (as we'll eventually
send the new update anyway, and it might get rejected without the
corresponding `channel_announcement`).

Sadly, our comparison for this was the wrong way, so we actually
*only* forwarded updates which were for channels we haven't yet
backfilled, and dropped updates for channels we already had
backfilled.
In 686a586 we stopped punishing
peers for slowly draining the gossip forwarding buffer, delaying
responding to our ping message. While that change was nice on its
own, it also now allows us to be a bit more flexible with what
enters the `gossip_broadcast_buffer`.

Because we now do not count pending messages in
`gossip_broadcast_buffer` against the peer's ping-response timer,
there's no reason to continue to limit it based on
`messages_sent_since_pong`. Thus, we drop that restriction here.

However, in practice, the reason for the vast majority of gossip
forwarding drops on my node is the 24-message total queue limit,
rather than the `messages_sent_since_pong` limit. This limit was
set to bend over backwards trying to avoid counting message buffer
sizes while keeping peer message buffers small.

In practice, there is really no reason to do that - summing the
capacity of tens of buffers is negligible cost and allows us to be
much more flexible with how many messages we queue.

Here we do so, limiting the total outbound message buffer size
before gossip forwards are dropped to 128 KiB per peer, rather than
24 messages. In practice, this appears to almost entirely remove
gossip forward drops on my node.
@TheBlueMatt TheBlueMatt force-pushed the 2025-09-limt-gossip-by-size branch from 86d115c to 8f3775d Compare September 22, 2025 18:34
@TheBlueMatt
Copy link
Collaborator Author

Now based on #4107 should pass CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants