proxy-types: prevent race condition when reading client.m_context.connection #293

pull ViniciusCestarii wants to merge 1 commits into bitcoin-core:master from ViniciusCestarii:fix-clientdestroy-race changing 1 files +8 −1
  1. ViniciusCestarii commented at 8:54 PM on June 9, 2026: contributor

    Fixes data race on reading m_context.connection in clientDestroy() in proxy-types.h.

    The read was unsynchronized while the disconnect cleanup callback (registered with addSyncCleanup in the ProxyClientBase constructor) clears the same field under m_context.loop->m_mutex. When a ProxyClient is destroyed on the async cleanup thread while the connection is torn down on the event loop thread, the two accesses race.

    In practice the race is not harmfull because the value only selects a log message but it can fail the TSan build, which makes the CI fail.

    The regression test added in 90be835 let the disconnect-during-cleanup path run, exposing the race under TSan.

    Fix: lock m_context.loop->m_mutex around the read, matching the lock the disconnect callback already uses for the write.

  2. proxy-types: prevent race condition when reading client.m_context.connection effb64f3cf
  3. DrahtBot commented at 8:54 PM on June 9, 2026: none

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #286 (proxy-client: fix TSan data race in clientDestroy by ryanofsky)
    • #269 (proxy: add local connection limit to ListenConnections by enirox001)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. ViniciusCestarii commented at 10:07 PM on June 9, 2026: contributor

    Just looked #286. Closing this pr since this is a duplicate

  5. ViniciusCestarii closed this on Jun 9, 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-06-24 04:30 UTC

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