test: Set tsan enable_adaptive_delay=1 by default #36308

Manually merged
maflcko merged 4 commits from 2609-tsan-test-adapt-delay into master 2026-10-06 12:46:12 +00:00 AGit
maflcko commented 2026-09-21 09:07:08 +00:00 (Migrated from github.com)

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.

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.
DrahtBot commented 2026-09-21 09:07:18 +00:00 (Migrated from github.com)

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

External sites

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 <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #35762 (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.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36308 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36308.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36308#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [Conradgabe](https://github.com/bitcoin/bitcoin/pull/36308#issuecomment-5873344843), [BrandonOdiwuor](https://github.com/bitcoin/bitcoin/pull/36308#pullrequestreview-5426652708), [sedited](https://github.com/bitcoin/bitcoin/pull/36308#pullrequestreview-5428428247) | 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](https://github.com/bitcoin/bitcoin/pull/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-->
dergoegge (Migrated from github.com) approved these changes 2026-09-22 08:56:58 +00:00
dergoegge (Migrated from github.com) left a comment

utACk fa0d826eac

utACk fa0d826eac336238642428a14db9d122aa6ecd4d
maflcko commented 2026-09-24 11:45:27 +00:00 (Migrated from github.com)

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
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
Conradgabe commented 2026-09-28 15:36:55 +00:00 (Migrated from github.com)

tACK fa0d826eac

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.

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.
First-time contributor

Base: 65896ac58ea63e29ad19d41b492e37f8722ac715
Head: fa0d826eac336238642428a14db9d122aa6ecd4d

No verified findings are available from this partial review.

Review coverage was incomplete. The archaeology review had incomplete evidence. The design review had incomplete evidence.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> Base: `65896ac58ea63e29ad19d41b492e37f8722ac715` Head: `fa0d826eac336238642428a14db9d122aa6ecd4d` No verified findings are available from this partial review. Review coverage was incomplete. The archaeology review had incomplete evidence. The design review had incomplete evidence. [Full review report](<https://review.fish.foo/traces/36308-fa0d826eac336238642428a14db9d122aa6ecd4d-315-1.html>)
fanquake commented 2026-09-29 13:12:38 +00:00 (Migrated from github.com)

cc @Crypt-iQ

cc @Crypt-iQ
BrandonOdiwuor (Migrated from github.com) reviewed 2026-10-06 09:52:31 +00:00
BrandonOdiwuor (Migrated from github.com) left a comment

ACK fa0d826eac

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

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

  • Bare util_string_tests (without the runtime options)
Image
  • with runtime options enabled through with_sanitizer_env.py:
Image
  • wallet_disable.py picks up those options with no manual export, both directly and through test_runner.py:
Image
  • tested enable_adaptive_delay=1 on tsan
Image
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://git.fish.foo/attachments/3757137d-cbbf-4794-a821-3793415f8e6c" /> **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://git.fish.foo/attachments/2ec9405d-16a7-45a6-b968-3f33a9201aaa" /> - with runtime options enabled through `with_sanitizer_env.py`: <img width="986" height="117" alt="Image" src="https://git.fish.foo/attachments/230b2ab4-135e-48e1-a497-57e39ad9dc09" /> - `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://git.fish.foo/attachments/20c6e42c-24f2-4084-88f9-90b02e2198c8" /> - tested `enable_adaptive_delay=1` on tsan <img width="1477" height="388" alt="Image" src="https://git.fish.foo/attachments/92b78bb5-32d6-4fcf-9fbf-b49153d4dba6" />
maflcko commented 2026-10-06 11:47:58 +00:00 (Migrated from github.com)

test-only change with three acks rfm?

test-only change with three acks rfm?
sedited (Migrated from github.com) approved these changes 2026-10-06 12:38:16 +00:00
sedited (Migrated from github.com) left a comment

utACK fa0d826eac

utACK fa0d826eac336238642428a14db9d122aa6ecd4d
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36308
No description provided.