discovery: fix race on remoteUpdateHorizon in GossipSyncer#10530
discovery: fix race on remoteUpdateHorizon in GossipSyncer#10530Roasbeef merged 1 commit intolightningnetwork:masterfrom
Conversation
Summary of ChangesHello @NishantBansal2003, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical race condition in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a race condition in GossipSyncer when accessing remoteUpdateHorizon. By introducing a lock to safely read the pointer into a local variable at the beginning of FilterGossipMsgs, the change effectively prevents both the data race and a potential nil pointer dereference. The previous implementation had a time-of-check to time-of-use bug that is now resolved. The fix is clean, correct, and well-contained. I approve these changes.
Roasbeef
left a comment
There was a problem hiding this comment.
Nice! Can we add a repro test here that would fail with the race condition detector but pass with this patch? One way to do this would be a mini property based test so it'll run many times per test invocation to make sure the issue is addressed.
🟠 PR Severity: HIGH
🟠 High (1 file)
AnalysisThis PR addresses a race condition in the gossip syncer component ( Why HIGH severity:
No severity bump applied:
This fix requires review by a knowledgeable engineer familiar with the gossip protocol and concurrent programming patterns in lnd. To override, add a |
3efd2ac to
985d4a4
Compare
🟠 PR Severity: HIGH
🟠 High (1 file)
🟢 Tests (1 file)
AnalysisThis PR is classified as HIGH severity because it modifies the Key considerations:
While the change is small and well-contained, the gossip protocol is essential for maintaining an accurate view of the Lightning Network topology. A race condition in this area could potentially cause nodes to miss routing updates or have inconsistent network views. Recommendation: This PR requires review from an engineer knowledgeable about the discovery/gossip subsystem to ensure the synchronization fix is correct and doesn't introduce new edge cases. To override, add a |
|
Needs a rebase! |
Guard access to remoteUpdateHorizon to prevent a race when the gossiper is flushing a pending batch of announcements while concurrently processing a GossipTimestampRange message from a peer. Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
985d4a4 to
caa2479
Compare
🟠 PR Severity: HIGH
🟠 High (1 file)
🟢 Test Files (1 file - not counted)
AnalysisThis PR fixes a race condition in the Severity Rationale:
Review Focus:
To override, add a |
|
No changelog here is np as it's a small bug fix. |
Change Description
This commit fixes a race condition in
GossipSyncerrelated toremoteUpdateHorizon.The race could occur when the gossiper is flushing a pending batch of new announcements to the network while concurrently processing a
GossipTimestampRangemessage from a peer.Steps to Test
The issue was discovered during state machine fuzzing of the gossip protocol operation.