Skip to content

ci(sanitizers): the asan job fails on what it finds; tsan in a pool; valgrind runs every test, two at a time (follow-up to #3279) - #3290

Merged
vpacher merged 14 commits into
masterfrom
ci/3238-sanitize-parallel-tests
Nov 1, 2026
Merged

vpacher merged 14 commits into
masterfrom
ci/3238-sanitize-parallel-tests

Conversation

@vpacher

@vpacher vpacher commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #3238. Refs #3251, #3307. Follow-up to #3279. Needs #3403 and #3404 (merged).

Why

Since #3279, the sanitizer job runs the unit tests side by side, and three tests that pass one at a time fail on master: test_xshm_monitor_late, test_xshm_monitor_hotplug (shared X display) and test_async_delay_audio (timing). The job still concludes "success": a unit-test failure shows only in the summary, because fail_on_findings is off. While measuring this, two more silent gaps showed up: 101 valgrind tests never ran at all, and exit 77 (ctest's "skipped") was reported as a failure next to real ones. On #3307, the masked failures and "make the sanitizer job fail on a unit-test failure" were assigned to this PR.

What changes

  1. Own X server per pooled test. On the one shared display, tests side by side break each other (test_xshm_monitor_late: "cannot add RandR monitors"). Each pooled test runs under xvfb-run -n <number> -f <build>/xauth/<test>, without the shared DISPLAY, as Tier 2 does through ctest. The auth file sits outside xvfb-run's temporary directory: with it inside, xvfb-run's cleanup failed now and then and its exit 5 replaced the test's (tsan pool run 41275822723).
  2. Timing-sensitive tests alone. test_async_delay_audio, test_slideshow_mem_cap, test_deinterlace_mode_load and test_dock_proportions hold RESOURCE_LOCK timing; the pool runs them one at a time after the others.
  3. Pool size per tool. asan and tsan use every core; valgrind runs two tests at a time (measured, see Numbers). Every pass that runs tests side by side gives each its own X server. SANITIZE_JOBS overrides; SANITIZE_JOBS=1 runs on the shared display.
  4. valgrind runs every test. obs_test_sanitize() adds per-target ASan unless the build flags already have -fsanitize=. valgrind's have none, so 101 tests (every *_steps/*_rust test of the test graph and 12 in tests.d) were built with ASan and died at start under valgrind ("ASan runtime does not come first"). The valgrind configure now passes -DOBS_TEST_SANITIZE_PER_TARGET=OFF.
  5. The asan job fails on findings. ci/sanitizers_step.py passes --fail-on-findings for asan with or without the input; tsan and valgrind still only report until their findings are triaged (ci(sanitizers): about 150 tests report ThreadSanitizer races and nobody triages them #3369). Exit 77 is a skip, not a failure.
  6. A known list that keeps itself honest. Tests that fail on master today are in KNOWN in rust/tools/sanitize/triage.py, each with a kind and its issue, and the summary lists them first:
  7. test_slideshow_mem_cap 100 s → 42 s. In folder_keeps_every_picture, each of 12 presses waited out its 5 s timeout: a folder is read in directory order, so the index is never the picture's number. A press that does not land now fails (RED), and in a folder a press lands when another picture is shown (GREEN). No assertion is removed. This is also the longest test in Tier 2.

Known list (asan)

Test Kind Issue
test_transition_render_steps bug #3362 (the sanitizer build fuses a multiply-add)
test_core_setup_rules_steps, test_no_core_getters bug #3363 (UBSan: &obs->audio with no core)
test_shutdown_canvas_weak_ref, test_shutdown_type_lifetime bug #3364 (leak at obs_shutdown)
test_media_remux, test_media_alpha_network bug #3365 (FFmpeg buffer leaks)
test_dock_proportions flaky #3366
test_ws_cpu_usage flaky #3367
test_async_delay_audio flaky #3368 (with #838)
test_darken_transparent flaky #3389 (reads the output before the scene is drawn)
test_deinterlace_mode_load flaky #3390 (Yadif 2x check runs out of its 3 s)

All are sub-issues of #3238. Order after this PR: #3363, #3362, #3364, #3365, #3366–#3368, #3389, #3390, then #3370. The tsan backlog is #3369.

Against real runs, the new triage fails #3279's master run 41246480225 on test_xshm_monitor_late and test_xshm_monitor_hotplug, and passes the serial nightly 41203573843 and this branch's asan run.

Note: the asan pass that build-project.yaml runs on a PR that changes a target in the conversion ratchet now fails on new findings too.

Commits

Seven RED/GREEN pairs, each RED failing as stated in its message:

  1. own X server per asan test, tsan/valgrind serial
  2. the timing lock
  3. skip exit, known findings, asan gate, valgrind without per-target ASan, slideshow press
  4. the known list keeps itself honest
  5. own auth file per private X server
  6. tsan in the pool, valgrind one at a time
  7. valgrind two at a time (serial with every test did not fit the job's 150 minutes)

Numbers

Unit-test phase and whole job, against the serial runs before #3279:

Pass Serial Pool (measured) This PR
asan 16.8 min / 40.6 min (41237708627) 5.1 min (41238464885, broke 3 tests) 6.5 min / 20.7 min (41297998272): 633/633 clean, 12 known
tsan 20.3 min / 41 min (nightly 41203573843) 8.2 min (41275822723) 7.4 min / 28.5 min (41281819710), no xvfb-run exit 5
valgrind 82 min / 95 min (nightly 41203573843), 101 tests dead at start 4 jobs: 50.5 min (41275824985), 9 tests newly failed on timing 2 jobs: 53.8 min / 66.5 min (41292487039), with the 101 tests (99 clean)

With every test, serial valgrind ran out of time: run 41281819710 was at 143 min, unit tests at 134 min and not done, against the job's 150. On a local build box, the same valgrind build and the same 108-test sample, each on its own 4 cores: 2 jobs ran the pool part 1.78x faster than 1 job, with the same results. Measurement runs used throwaway branches; they are deleted.

Open for #3369 (valgrind only reports): with 2 jobs test_group_child_drift (1 case) and test_transition_recursive_destination fail, which passed in the serial nightly; test_slideshow_mem_cap, test_output_filename_reserve and test_audio_clock_drift hit the 600 s limit, as in the serial nightly (30 of the 54 minutes).

Tests

  • ci/test_sanitize_harness.py, ci/test_sanitize_triage.py, ci/test_sanitizers_step.py: 49/49.
  • test_slideshow_mem_cap in a Tier 2 tree on a local build box: RED fails folder_keeps_every_picture at the first press; GREEN 3/3 passes, 41.4–42.8 s (was 100 s).
  • Local gate, stamped head 476b830: 4 min 13 s (lint 38 s, rust-test 82 s, cross 39 s, tier2-linux 253 s).
  • One dispatch per tool (this path does not select the sanitizer lanes on a PR): asan 41297998272 on 476b830, tsan 41281819710 on f701c97, valgrind 41292487039 on 1727c20. Since f701c97, tsan still runs on every core with private X servers; the later commits change only valgrind's job count and the asan known list.

Checklist

🤖 Generated with Claude Code

@vpacher
vpacher requested a review from zackees as a code owner October 31, 2026 21:55
@vpacher
vpacher enabled auto-merge October 31, 2026 21:56
@vpacher
vpacher disabled auto-merge October 31, 2026 22:04
@vpacher
vpacher marked this pull request as draft October 31, 2026 22:09
@vpacher
vpacher force-pushed the ci/3238-sanitize-parallel-tests branch from a846614 to ccd06f3 Compare October 31, 2026 22:12
@vpacher vpacher changed the title ci(sanitizers): run the asan unit tests in a pool (#3238) ci(sanitizers): own X server per asan test, timing tests alone, tsan/valgrind serial (follow-up to #3279) Oct 31, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Oct 31, 2026
@vpacher
vpacher force-pushed the ci/3238-sanitize-parallel-tests branch from ccd06f3 to f701c97 Compare November 1, 2026 06:41
@vpacher
vpacher force-pushed the ci/3238-sanitize-parallel-tests branch 2 times, most recently from 4c167b6 to 1727c20 Compare November 1, 2026 09:17
vpacher and others added 3 commits November 1, 2026 11:27
…#3238)

#3279 (#3251) runs the sanitizer unit tests in a pool of every core, on
the one Xvfb display sanitize.py starts, for every tool. The same design,
measured before #3279 merged (dispatch 41238464885 against the serial
41237708627, both on a5feec4), changed three exit codes: with tests
side by side on one display, test_xshm_monitor_late failed in its setup
("cannot add RandR monitors"), and test_dock_proportions failed 6 checks
instead of 1. Tier 2 runs the same tests in parallel without that,
because ctest gives each test its own server through xvfb-run. tsan and
valgrind were not measured in a pool, and valgrind needs far more memory
per test.

TestIsolationTest in ci/test_sanitize_harness.py:
- with private_displays, run_tests() runs every test, serial ones too,
  under xvfb-run with its own server number and without the shared
  DISPLAY (a fake xvfb-run records both);
- private_displays(): asan only; unit_test_jobs(): every core for asan,
  1 for tsan and valgrind, SANITIZE_JOBS overrides;
- run_unit_tests() passes both for its tool.

uv run --no-project python -m unittest ci/test_sanitize_harness.py:
2 errors, 1 failure (run_unit_tests gives valgrind every core), 17 pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al (#3238)

run_tests() takes private_displays: each test then runs through the
runner with its own Xvfb server number (a per-run counter from 100; the
shared display is :90 to :98). run_one_test() runs it under xvfb-run -n
with the shared screen size and leaves the shared DISPLAY out of its
environment, so the tests registered with xvfb-run-or-display.sh start
their own server instead of falling back to it. The serial tests after
the pool get one too.

run_unit_tests() passes unit_test_jobs(tool) and private_displays(tool):
asan runs every core at a time, each test on its own server; tsan and
valgrind run one test at a time on the shared display, as before #3279.
SANITIZE_JOBS overrides the pool size. run_tests() keeps its defaults
for direct callers.

The end-to-end harness test gets a pass-through xvfb-run stub, as it has
one for Xvfb.

uv run --no-project python -m unittest ci/test_sanitize_harness.py: 20
passed; test_cmocka_sanitize, test_sanitize_triage, test_sanitizers_step
and test_sanitize_deps pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With an own X server per test (dispatch 41242258179), four tests still
changed in the asan pool: test_async_delay_audio (the tone broke up
once), test_slideshow_mem_cap (a fade's wall-clock check),
test_deinterlace_mode_load (a frame-timing check) and
test_dock_proportions (a Qt layout that settles on timers). Their checks
depend on timing, and four ASan processes on four cores leave them no
slack.

TimingLockTest in ci/test_sanitize_harness.py: the three tests.d tests
and the test-graph entry of test_deinterlace_mode_load hold the ctest
RESOURCE_LOCK "timing", which the pool runs alone after the others; a
RESOURCE_LOCK test is serial in ctest_tests().

uv run --no-project python -m unittest ci/test_sanitize_harness.py:
1 failure (test_async_delay_audio holds no lock), 21 pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vpacher and others added 11 commits November 1, 2026 11:27
test_async_delay_audio, test_dock_proportions and test_slideshow_mem_cap
(tests.d) and test_deinterlace_mode_load (test-graph.json resource_locks)
hold the ctest RESOURCE_LOCK "timing". The asan pool runs a RESOURCE_LOCK
test alone after the others, so these four keep the quiet machine they
had in the serial run. In Tier 2, ctest only keeps the four from
overlapping each other; every other test still runs beside them. No
change to sanitize.py: a lock already made a test serial. A new
timing-sensitive test takes the same lock.

uv run --no-project python -m unittest ci/test_sanitize_harness.py: 23
passed; ci/test_test_graph_sorted.py passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…San, slideshow press (#3238)

Tests for the sanitizer job failing on what it finds:
- triage: exit 77 (ctest's skip) is a skip, not a failure; a KNOWN test's
  exit and sanitizer reports are listed, not counted; a KNOWN test that ran
  clean is listed; an unknown failure still counts.
- the triage step fails the asan pass on findings without the input;
  tsan keeps reporting only.
- the valgrind configure turns off the cmocka tests' own ASan.
- test_slideshow_mem_cap: a press that never lands fails. RED on CT115:
  folder_keeps_every_picture fails at the first Next ("did not land in
  5 s"); each of its 12 presses waited out the 5 s before.

Fails: 5 triage/step cases, 1 harness case (no tool_cmake_args), the
slideshow folder case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… ASan, slideshow press (#3238)

- triage.py: exit 77 is a skip. KNOWN covers a test's exit and its sanitizer
  reports, with ten asan entries, each naming the issue that tracks it; a
  KNOWN test that ran clean is listed so its entry can go.
- sanitizers_step.py: asan fails the job on findings with or without the
  fail_on_findings input; tsan and valgrind still report only.
- sanitize.py: the valgrind build turns off the cmocka tests' own ASan
  (-DOBS_TEST_SANITIZE_PER_TARGET=OFF). 101 valgrind tests died at start
  ("ASan runtime does not come first") and never ran.
- test_slideshow_mem_cap: in a folder the index is not the picture, so a
  folder press lands when another picture is shown. CT115 Tier 2 tree,
  3 runs: 41.4-42.8 s, was 100 s (folder case 61 s -> <1 s).

Harness tests: 46 OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each KNOWN entry gets a kind (bug, flaky or tool) and bug and flaky entries
name their issue; a known bug that ran clean is a finding, so the fix that
makes it pass must drop its entry; the known list comes first in the
summary, above the failures.

Fails: 2 triage cases and the KNOWN shape check (entries are plain strings).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
KNOWN entries are (kind, why): "bug" (the test is right, OBS or its build
is wrong), "flaky" (the test is not solid yet) and "tool" (a valgrind
limitation). A known bug that ran clean counts as a finding, so the fix
must drop its entry; a flaky one that ran clean is listed. The known list
comes first in the summary.

Against real runs: #3279's master asan run 41246480225 fails on
test_xshm_monitor_hotplug and test_xshm_monitor_late; the serial nightly
41203573843 and this branch's run 41247123560 pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
)

In the tsan pool run 41275822723, test_xshm_monitor_move and
test_media_cover_art_monitor exited 5: "xvfb-run: error: problem while
cleaning up temporary directory". xvfb-run's own exit replaced the test's.
The test now expects `-f <build>/xauth/<test>` on every private server.

Fails: test_each_test_gets_its_own_x_server (no -f, so the stub's shift
runs into the command).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3238)

run_one_test passes `-f <build>/xauth/<test>` to xvfb-run, so its cleanup
only removes an empty temporary directory and the test's own exit status
reaches the summary. The build tree is not uploaded, so the cookies stay
out of the artifact. Harness tests: 49 OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured on throwaway refs with a pool and private displays for every tool,
against the serial nightly 41203573843:
- tsan 41275822723: unit tests 20.3 -> 8.2 min; a few more races found
  (145 tests with reports, was 137), as more interleavings show them.
- valgrind 41275824985: unit tests 82 -> 50.5 min, but 9 tests newly fail
  (4 timing tests exit 1, 4 new valgrind errors, 1 with 18 failed cases),
  so it stays serial until it is measured with fewer jobs.

Fails: test_private_displays_and_pool_size_per_tool (tsan is serial).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
POOLED = {"asan", "tsan"}: both run their unit tests on every core, each on
its own X server; valgrind keeps one test at a time on the shared display.
Harness tests: 49 OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the 101 tests that died at start now running (the valgrind build has
no per-target ASan), the serial valgrind pass no longer fits the job's
150 minutes: run 41281819710 was 143 min in, unit tests at 134 min and
two timing tests still to go.

Measured on a local build box, the same valgrind build, the same 108-test
sample, at the same time, each on its own 4 cores:
- 1 job: 1443 s (746 s timing tests alone, 697 s pool part)
- 2 jobs: 1136 s (744 s timing tests alone, 392 s pool part), 1.78x on
  the pool part, with the same results as 1 job except
  test_source_monitor_only_load, which also fails serially (nightly
  41203573843).
4 jobs (41275824985) had broken 9 tests on timing.

Fails: test_private_displays_and_pool_size_per_tool and
test_run_unit_tests_uses_the_tool_settings (valgrind runs one
test at a time on the shared display).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valgrind runs VALGRIND_JOBS = 2 unit tests at once; private_displays() now
follows the job count, so every pass that runs tests side by side gives
each its own X server, and SANITIZE_JOBS=1 still runs valgrind on the
shared display. The timing-locked tests stay alone after the pool.
Harness tests: 49 OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=59bf78986128b0bf3e88e3b0e1c3faa6700e3c55 secs=254 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1793529162,"gate":"rust/all/fmt","host":"linux-x86_64","key":"4e5e3858d8491199c49bb2e8f32403634c6802f54e8060aee6fb528fdb666fec","lane":"lint","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":38,"stamp":"27cd4b8ad907603c69fe3a8d0fe985fd","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"4e5e3858d8491199c49bb2e8f32403634c6802f54e8060aee6fb528fdb666fec","lane":"lint","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":38,"stamp":"d5a93a648d856ea3fe2659f25a8a54d1","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"0d5d8c901437764902057b062a2a2970307cc3ef96866b8f0eb1c3bd40245bce","lane":"rust-test","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":82,"stamp":"1578f2a2f93b9e070ce6255b93ddce86","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"f9b86b3e7b4c56f30c9c84c28b7cc4f0e5c9112c17da38c138e0b09cd930f9e3","lane":"cross","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":39,"stamp":"0ae2c63e36d2c1ad058c2dd863465dee","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"f9b86b3e7b4c56f30c9c84c28b7cc4f0e5c9112c17da38c138e0b09cd930f9e3","lane":"cross","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":39,"stamp":"35bbe7cd711b3a574ef3f63e087fff88","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"f9b86b3e7b4c56f30c9c84c28b7cc4f0e5c9112c17da38c138e0b09cd930f9e3","lane":"cross","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":39,"stamp":"1374fb0edef543694df2502a436e4d46","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"f9b86b3e7b4c56f30c9c84c28b7cc4f0e5c9112c17da38c138e0b09cd930f9e3","lane":"cross","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":39,"stamp":"198864707a8d0b9fc19e977d32913681","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
Ci-Attestation: {"at":1793529162,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"2759ea0a08270136ee9a68523ff733c6af0ea1afbb4449a3e97c61aa574ed7a1","lane":"tier2-linux","parents":["6f40abc2382eae22194ee07c3b2d481f2d021586"],"secs":253,"stamp":"1ecdab1fd6760422148507c14323e139","tree":"59bf78986128b0bf3e88e3b0e1c3faa6700e3c55","v":1,"via":"run"}
@vpacher
vpacher force-pushed the ci/3238-sanitize-parallel-tests branch from 1727c20 to 476b830 Compare November 1, 2026 10:33
@vpacher vpacher changed the title ci(sanitizers): own X server per asan test, timing tests alone, tsan/valgrind serial (follow-up to #3279) ci(sanitizers): the asan job fails on what it finds; tsan in a pool; valgrind runs every test, two at a time (follow-up to #3279) Nov 1, 2026
@vpacher
vpacher marked this pull request as ready for review November 1, 2026 10:57
@vpacher
vpacher added this pull request to the merge queue Nov 1, 2026
Merged via the queue into master with commit 93070d8 Nov 1, 2026
42 checks passed
@vpacher
vpacher deleted the ci/3238-sanitize-parallel-tests branch November 1, 2026 11:09
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Done in obs-rust Multiview Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ci(sanitizers): the ASan unit tests run one at a time and take 20 of the job's 26 minutes

1 participant