Use `WITH_LOCK` in `Warnings::Set` #30404

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:warnings-min-lock changing 1 files +1 −2
  1. achow101 commented at 10:15 PM on July 6, 2024: member

    The scope of the lock should be limited to just guarding m_warnings as anything listening on NotifyAlertChanged may execute code that requires the lock as well.

    Fixes #30400

  2. Use WITH_LOCK in Warnings::Set
    The scope of the lock should be limited to just guarding m_warnings as
    anything listening on `NotifyAlertChanged` may execute code that
    requires the lock as well.
    6af51e8198
  3. DrahtBot commented at 10:15 PM on July 6, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. achow101 added this to the milestone 28.0 on Jul 6, 2024
  5. TheCharlatan approved
  6. TheCharlatan commented at 9:01 AM on July 7, 2024: contributor

    ACK 6af51e819847e737449609daa214e16f9453e85d

  7. maflcko commented at 9:32 AM on July 8, 2024: member

    lgtm ACK 6af51e819847e737449609daa214e16f9453e85d

  8. glozow commented at 10:06 AM on July 8, 2024: member
  9. glozow requested review from stickies-v on Jul 8, 2024
  10. willcl-ark approved
  11. willcl-ark commented at 1:18 PM on July 8, 2024: member

    ACK 6af51e819847e737449609daa214e16f9453e85d

    It's generally best-practice to hold locks for the shortest possible time to minimize contention.

  12. stickies-v approved
  13. stickies-v commented at 1:37 PM on July 8, 2024: contributor

    ACK 6af51e819847e737449609daa214e16f9453e85d

    This seems quite tricky to have test coverage for (since it only manifests in bitcoin-qt), and unfortunately the EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) annotations didn't catch this either, so I'm not sure if there's much more we can do to prevent regressions?

    Review note: easy steps to reproduce are here. Thanks again for finding this @achow101 .

  14. glozow merged this on Jul 8, 2024
  15. glozow closed this on Jul 8, 2024

  16. bitcoin locked this on Jul 8, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:13 UTC

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