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
  1. ryanofsky commented at 2:35 AM on August 13, 2026: collaborator

    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.

  2. 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>
    137a6e4e03
  3. 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>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. 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.

  5. ryanofsky commented at 4:54 AM on August 13, 2026: collaborator
  6. 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!

  7. ryanofsky merged this on Aug 13, 2026
  8. ryanofsky closed this on Aug 13, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-26 01:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me