You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky: tests that need process-wide isolation race since #978 merged them into shared binaries #1133
#1128 didn't cause this; the previous 14 master pushes passed. The cause is #978 (a263104).
Cause. The test asserts absolute deltas of bnum_allocs(), a process-wide counter. Its header says why it has to run alone:
This lives in its own test binary with a single test on purpose: bnum_allocs is a process-global counter, so asserting absolute deltas races with any concurrent allocation — including a second test in the same binary.
#978 (category binaries, #968) moved it into rust/obs-util/tests/threading/main.rs with task, task_stress, threading_stress and others, 39 tests in all, which run in parallel by default. Any of them that allocates through bmem between the test's base read and its check moves the counter.
Fix options (the binary cap ci/test_binary_cap.py stops it going back to its own tests/*.rs: obs-util is already at 8 of 8):
Run the body in a child process. The test re-executes std::env::current_exe() with --exact threading_allocs::... --test-threads=1 and an env var, and the child does the measurement. This keeps the binary count unchanged and makes the test deterministic.
Exempt this one test from the cap with a documented allow-list entry in ci/test_binary_cap.py and restore tests/threading_allocs.rs.
Check the same thing without the global counter, for example by counting allocations in the oracle stand-ins on the calling thread only.
Also check the other tests that #978 moved for header comments about running alone, or for reads of bnum_allocs.
The same race can hit rust/obs-util/tests/memory/bmem_parity.rs. Its matches_c_oracle proptest reads rs::bnum_allocs() before and after each op, and #978 put it in the memory binary next to bmem.rs, whose tests allocate through bmem in parallel. Whatever fix is chosen should cover both.
changed the title [-]Flaky: threading_allocs races other tests since #978 merged it into the shared threading binary[/-][+]Flaky: tests that need process-wide isolation race since #978 merged them into shared binaries[/+]on Oct 17, 2026
A third case, in the platform binary. Fast Gate on #1094 (run 38996720085, 2026-10-17 ~03:05 UTC) failed with:
---- pipe_parity::process::dead_pipe_write_survives_concurrent_spawns ----
panicked at rust/obs-util/tests/platform/pipe_parity.rs:459:13
left: b"sh: 0: getcwd() failed: No such file or directory\nclosed\n"
right: b"closed\n"
platform_nix_parity::getcwd_matches_and_chdir_roundtrips changes the process working directory into a scratch("cwd") directory and removes it afterwards. It only holds its own cwd_lock(). pipe_parity spawns sh children under a different lock (SPAWN). Since #978 put both files in one binary, a child can start with the cwd set to the scratch directory just as the directory is removed, and sh then prints that getcwd() warning to the stderr the test compares.
#1094 doesn't touch either file; I re-ran its failed jobs. The fix belongs with the other two: a test that changes process-wide state (cwd, the bnum_allocs counter) can't share a parallel test binary with tests that depend on that state. Options: run it in a child process, share one lock across both modules (the cwd test and every spawn), or, for this one, do the chdir round trip in a forked child so the parent's cwd never moves.
Correction to the third case above. The leaked-fd failure on #1094's next run (1 of 3000 writes reached a dead child through a leaked fd) came from my own maintainer push. I had moved #1094's forking platform_oracle tests into the platform binary next to pipe_parity. That one is now fixed on #1094 by moving them to profiler. The getcwd() failed race between platform_nix_parity's chdir test and pipe_parity's spawns is separate and still open; it's on master already. General rule for whoever fixes this issue: a test that forks without exec, changes the cwd, or reads bnum_allocs must not share a parallel test binary with tests that depend on that state.
Claiming: option 1 (child process). A shared test helper re-executes the test binary with --exact <test> --test-threads=1 and an env var; the child does the bnum_allocs measurement, the parent asserts the child passed. Applied to threading_allocs::init_destroy_counts_one_bzalloc_per_live_handle and bmem_parity's counter checks. RED is deterministic: a background thread allocating through bmem while the in-process measurement runs; GREEN passes with that thread still running because the measuring process is a separate one.
Activity
zackees commentedon Oct 16, 2026
The same race can hit
rust/obs-util/tests/memory/bmem_parity.rs. Itsmatches_c_oracleproptest readsrs::bnum_allocs()before and after each op, and #978 put it in thememorybinary next tobmem.rs, whose tests allocate through bmem in parallel. Whatever fix is chosen should cover both.[-]Flaky: threading_allocs races other tests since #978 merged it into the shared threading binary[/-][+]Flaky: tests that need process-wide isolation race since #978 merged them into shared binaries[/+]zackees commentedon Oct 17, 2026
A third case, in the
platformbinary. Fast Gate on #1094 (run 38996720085, 2026-10-17 ~03:05 UTC) failed with:platform_nix_parity::getcwd_matches_and_chdir_roundtripschanges the process working directory into ascratch("cwd")directory and removes it afterwards. It only holds its owncwd_lock().pipe_parityspawnsshchildren under a different lock (SPAWN). Since #978 put both files in one binary, a child can start with the cwd set to the scratch directory just as the directory is removed, andshthen prints thatgetcwd()warning to the stderr the test compares.#1094 doesn't touch either file; I re-ran its failed jobs. The fix belongs with the other two: a test that changes process-wide state (cwd, the
bnum_allocscounter) can't share a parallel test binary with tests that depend on that state. Options: run it in a child process, share one lock across both modules (the cwd test and every spawn), or, for this one, do the chdir round trip in a forked child so the parent's cwd never moves.zackees commentedon Oct 17, 2026
Correction to the third case above. The leaked-fd failure on #1094's next run (
1 of 3000 writes reached a dead child through a leaked fd) came from my own maintainer push. I had moved #1094's forkingplatform_oracletests into theplatformbinary next topipe_parity. That one is now fixed on #1094 by moving them toprofiler. Thegetcwd() failedrace betweenplatform_nix_parity's chdir test andpipe_parity's spawns is separate and still open; it's on master already. General rule for whoever fixes this issue: a test that forks without exec, changes the cwd, or readsbnum_allocsmust not share a parallel test binary with tests that depend on that state.zackees commentedon Oct 17, 2026
Claiming: option 1 (child process). A shared test helper re-executes the test binary with
--exact <test> --test-threads=1and an env var; the child does thebnum_allocsmeasurement, the parent asserts the child passed. Applied tothreading_allocs::init_destroy_counts_one_bzalloc_per_live_handleandbmem_parity's counter checks. RED is deterministic: a background thread allocating through bmem while the in-process measurement runs; GREEN passes with that thread still running because the measuring process is a separate one.test(obs-util): measure bmem counters in an isolated child process
test: bnum_allocs checks must hold while other tests allocate (RED)
test(obs-util): measure bmem counters in an isolated child process
test(obs-util): isolate bmem counter checks in a child process (obs-r…