This fixes an intermittent mptest failure which is a regression from #308. Commit bb473690c97ceed78a482d6a97b480cec4a63190 introduced a test with a race condition where there the test could trigger two different exceptions depending on when the client onDisconnect handler ran, and only one of the exceptions was being checked for in the test. If the onDisconnect handler ran later, the test would fail.
test: fix race in connect_tests disconnect-deferred-failure test #343
pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/disflake changing 1 files +7 −1-
ryanofsky commented at 2:35 AM on August 13, 2026: collaborator
-
137a6e4e03
test: fix race in connect_tests disconnect-deferred-failure test
The "ConnectStream defers disconnect failure" test was flaky: there is a race between the event loop detecting the disconnect and foo->add() being called. If the onDisconnect callback fires first and nulls m_context.connection, the error is "called after disconnect"; if foo->add() submits before the callback fires, the error is "interrupted by disconnect". Accept both, with a comment explaining the race. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-
DrahtBot commented at 2:35 AM on August 13, 2026: none
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline and AI policy for information on the review process.
Type Reviewers ACK xyzconstant If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
xyzconstant commented at 4:31 AM on August 13, 2026: contributor
ACK 137a6e4e03973b6fdc7d2fdf399f3fb37c2c9e1c
I couldn't reproduce the "IPC client method call interrupted by disconnect." path locally, so I'm curious what circumstances trigger it. In any case the changes look good to me, nice comment explaining the race.
-
ryanofsky commented at 4:54 AM on August 13, 2026: collaborator
I couldn't reproduce the "IPC client method call interrupted by disconnect." path locally.
I think it might help to have a slower machine, since it happens when the event loop thread is slow to process the disconnect. Some failures from https://github.com/bitcoin/bitcoin/pull/32387 were
https://github.com/bitcoin/bitcoin/actions/runs/31655880824/job/94310097312 https://github.com/bitcoin/bitcoin/actions/runs/31655880824/job/94310097504 https://github.com/bitcoin/bitcoin/actions/runs/31655880824/job/94310097306 https://github.com/bitcoin/bitcoin/actions/runs/31655880824/job/94310097431 https://github.com/bitcoin/bitcoin/actions/runs/31655880824/job/94310097386
-
xyzconstant commented at 1:12 PM on August 13, 2026: contributor
I think it might help to have a slower machine, since it happens when the event loop thread is slow to process the disconnect. Some failures from bitcoin/bitcoin#32387 were
That makes sense, thanks!
- ryanofsky merged this on Aug 13, 2026
- ryanofsky closed this on Aug 13, 2026