test: Set tsan enable_adaptive_delay=1 by default #36308

pull maflcko wants to merge 4 commits into bitcoin:master from maflcko:2609-tsan-test-adapt-delay changing 8 files +81 −29
  1. maflcko commented at 9:07 AM on September 21, 2026: member

    There are several small sanitizer option issues:

    • Using the project's default settings outside of CI is only possible manually
    • Modifying the project's default requires modifying three places (docs, ci, and the fuzz runner)

    Fix both issues by adding a with_sanitizer_env.py ...cmd... command wrapper that sets the default values.

    Also, enable https://clang.llvm.org/docs/ThreadSanitizer.html#adaptive-delay, which may help to find some kind of rare races more frequently.

  2. doc: Remove section on how to install libasan etc
    The package name depends on the system and it should be trivial for a
    developer to install it in any way.
    fad2fc5a0f
  3. DrahtBot renamed this:
    test: Set tsan enable_adaptive_delay=1 by default
    test: Set tsan enable_adaptive_delay=1 by default
    on Sep 21, 2026
  4. DrahtBot added the label Tests on Sep 21, 2026
  5. DrahtBot commented at 9:07 AM on September 21, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK Conradgabe, BrandonOdiwuor, sedited

    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.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35762 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35762.svg"></sub> (test: optionally run functional tests via CTest by willcl-ark)

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

  6. test: Add with_sanitizer_env.py
    To run a command with default sanitizer options.
    
    This allows to de-duplicate the various places where options are
    hard-coded.
    
    Also, it should be easier to run tests locally with the options applied.
    faf907fd13
  7. test: Set tsan enable_adaptive_delay=1 by default fafce3be39
  8. maflcko force-pushed on Sep 21, 2026
  9. DrahtBot added the label CI failed on Sep 21, 2026
  10. DrahtBot removed the label CI failed on Sep 21, 2026
  11. test: Use sanitizer env in functional tests by default
    This allows to run the functional tests without having to manually set
    the sanitizer env.
    fa0d826eac
  12. maflcko force-pushed on Sep 21, 2026
  13. DrahtBot added the label CI failed on Sep 21, 2026
  14. DrahtBot removed the label CI failed on Sep 21, 2026
  15. dergoegge approved
  16. dergoegge commented at 8:56 AM on September 22, 2026: member

    utACk fa0d826eac336238642428a14db9d122aa6ecd4d

  17. maflcko commented at 11:45 AM on September 24, 2026: member

    Forgot to mention how to test the new sanitizer env:

    • Compile with -DSANITIZERS=undefined,integer,float-divide-by-zero (integer sanitizer requires a lot of suppressions)
    • On master, the tests will fail without the env vars, on this pull, they will pass.

    E.g the functional ones:

    ./bld-cmake/test/functional/wallet_disable.py
    ./bld-cmake/test/functional/test_runner.py wallet_disable.py
    

    Or a unit test (requires the env explicitly to pass):

    ./bld-cmake/bin/test_bitcoin -t util_string_tests  # fails
    
    ./bld-cmake/test/with_sanitizer_env.py ./bld-cmake/bin/test_bitcoin -t util_string_tests  # passes
    
  18. Conradgabe commented at 3:36 PM on September 28, 2026: none

    tACK fa0d826eac336238642428a14db9d122aa6ecd4d

    I tested the sanitizer-env wrapper (with_sanitizer_env.py) and its auto-load in functional tests and confirmed both work as described.

    I did not test the thread sanitizer / enable_adaptive_delay=1 change.

  19. fanquake commented at 1:12 PM on September 29, 2026: member
  20. BrandonOdiwuor commented at 9:52 AM on October 6, 2026: contributor

    ACK fa0d826eac336238642428a14db9d122aa6ecd4d

    Tested on Ubuntu 24.04, Clang:

    • with_sanitizer_env.py sets the project defaults, and lets an existing variable replace the whole default string rather than merging keys:

    <img width="1608" height="597" alt="Image" src="https://github.com/user-attachments/assets/44f16e08-2bb4-47bd-9d95-7c6ea357b1db" />

    Integer/UBSan build (-DSANITIZERS=undefined,integer,float-divide-by-zero):

    • Bare <code>util_string_tests</code> (without the runtime options)

    <img width="1915" height="959" alt="Image" src="https://github.com/user-attachments/assets/0921e34c-7219-437e-be0e-6bdfe8e20f8c" />

    • with runtime options enabled through with_sanitizer_env.py:

    <img width="986" height="117" alt="Image" src="https://github.com/user-attachments/assets/a9347fb1-67e3-4c16-9ae7-329441ac59aa" />

    • wallet_disable.py picks up those options with no manual export, both directly and through test_runner.py:

    <img width="1188" height="385" alt="Image" src="https://github.com/user-attachments/assets/d4bebe48-860c-4439-964c-ff5ebb2085ec" />

    • tested enable_adaptive_delay=1 on tsan

    <img width="1477" height="388" alt="Image" src="https://github.com/user-attachments/assets/dce4ea41-a51c-44fc-b415-e65417a3d01e" />

  21. maflcko commented at 11:47 AM on October 6, 2026: member

    test-only change with three acks rfm?

  22. sedited approved
  23. sedited commented at 12:38 PM on October 6, 2026: contributor

    utACK fa0d826eac336238642428a14db9d122aa6ecd4d

  24. sedited merged this on Oct 6, 2026
  25. sedited closed this on Oct 6, 2026

  26. maflcko deleted the branch on Oct 6, 2026

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-10-21 18:51 UTC

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