Commit message · Matt CoralloFix hang in `test_single_channel_multiple_mpp` on busy machines
`test_single_channel_multiple_mpp` claims an MPP payment from a
background thread while each `ChannelMonitorUpdate` persistence blocks
until the test sends into an mpsc channel. The claiming thread holds
node 8's per-peer lock while blocked, so the main thread can only take
that lock in the brief window after each update completes.
To fetch the first `commitment_signed`, the main thread called
`get_and_clear_pending_msg_events`, which takes the per-peer lock four
separate times. Only three updates were completed before it had to
return, and under CPU contention the main thread may get the lock only
once per update. It then stayed blocked on the lock while the claiming
thread waited for a write which only a thread spawned after the call
returns would send, hanging the test forever.
Instead, read the pending messages from the peer state directly,
taking the lock only once. Further, complete updates from a background
thread until each call returns, rather than a fixed number of times.
At least two are still completed while fetching the messages, so that
some claims are in the holding cell when the `revoke_and_ack` arrives.
Finally, accept any number of fulfills in each batch at the end, as
that depends on how far the claim got before the `revoke_and_ack` was
handled.
This may or may not be a complete fix, and may or may not make the
test unable to detect the original issue, but at this point it hardly
matters. We want to drop the test entirely in #4552 and its been racy
for so long that its starting to cause other issues.
Fixes #4744
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queuedboot or update path
AI analysis · Informational 16/100This change fixes a flaky automated test that could freeze forever on heavily loaded computers. It only touches test code, not the actual Lightning node software that users run, so it has no direct security impact on real deployments.