Fix thread starvation in test_single_channel_multiple_mpp
What changed, and why it matters
This is a fix inside a single test function. The test had a tight loop that repeatedly checked for events without ever pausing, which could monopolize a lock and prevent another thread in the same test from making progress. The change adds a brief yield so the other thread can run. It only affects test code, not production code, and has no security impact on real users.
No security action required. Treat as a normal test-flakiness fix. If backporting, include only for CI/test stability, not for security.
Security signals we found
No security signal: change is confined to test code
No attacker-controlled input or privilege boundary crossed
No cryptographic, network, or consensus logic modified
Evidence from the diff
In lightning/src/ln/chanmon_update_fail_tests.rs, the test test_single_channel_multiple_mpp spins calling get_and_clear_pending_events() on ChannelManager until a PaymentClaimed event appears. Because the loop never yielded, it could continuously acquire the ChannelManager lock and starve the claim_funds thread, causing a test hang or timeout. The patch adds std::thread::yield_now() when no event is found, matching two other spin loops in the same test. This is a test-only reliability fix.
Changed components
lightning/src/ln/chanmon_update_fail_tests.rstest function test_single_channel_multiple_mppInspect captured patch +3 / −0
diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs
index 3fa2073..e492562 100644
--- a/lightning/src/ln/chanmon_update_fail_tests.rs
+++ b/lightning/src/ln/chanmon_update_fail_tests.rs
@@ -4715,6 +4715,9 @@ fn test_single_channel_multiple_mpp() {
}
have_event = true;
}
+ if !have_event {
+ std::thread::yield_now();
+ }
}
});
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.