Repository navigation
Description
Build 🧱 / Rust Tier 2 (windows-2025-vs2026) is red on master code. Every PR that selects that lane now fails on test_core_setup_rules_steps for a reason unrelated to its own diff.
Evidence
Job 123456184550 of run 40875411169, on PR #2906 — a diff that touches only shared/file-updater/file-updater/curl-accept-encoding.h, two cmocka files and CMakeLists.txt. git diff origin/master <that head> -- test/cmocka/test_core_setup_rules_steps.c libobs is empty, so this is master's code:
142/327 Test #145: test_core_setup_rules_steps ....................***Failed 0.04 sec
[==========] callers: Running 7 test(s).
[ OK ] test_reset_video_gates
[ ERROR ] --- Test failed with exception: (11)
[ FAILED ] test_reset_audio_ticks
[ OK ] test_cmdline_once
[ OK ] test_latest_input_type
[ ERROR ] --- Test failed with exception: (11)
[ FAILED ] test_monitoring_device
[ OK ] test_frame_counts_without_mix
[ OK ] test_find_data_file_order
[ ERROR ] --- Test failed with exception: (11)
[ FAILED ] GROUP TEARDOWN
2 FAILED TEST(S)
99% tests passed, 1 tests failed out of 327
145 - test_core_setup_rules_steps (Failed) native-core
exception: (11) is SIGSEGV. The steps group passes in full (12/12), so the crash is confined to the group that starts a real core (group_setup → obs_startup).
Why it reached master
#2881 introduced this test, and its own PR run never exercised the lane:
$ gh pr view 2881 --json statusCheckRollup
Build 🧱 / Rust Tests 🦀 (windows-2025-vs2026) SKIPPED
Build 🧱 / Rust Tier 2 (windows-2025-vs2026) SKIPPED
CI Gate ✅ SUCCESS
Master's push runs skip Windows Tier 2 as well, so the lane's first real exercise is an unrelated PR that selects it — which is what #2906 hit.
Where it crashes (read from the code; not a stack trace)
Both failing tests call obs_reset_audio2() from a cold audio core, and it is the first thing test_reset_audio_ticks does:
static void test_reset_audio_ticks(void **state)
{
SKIP_WITHOUT_OBS();
assert_true(obs_reset_audio2(NULL)); /* test_core_setup_rules_steps.c:409 */obs_reset_audio2() calls obs_free_audio() before it validates oai (libobs/obs.c.h:1610), and obs_free_audio() unconditionally destroys two mutexes:
pthread_mutex_destroy(&audio->task_mutex);
pthread_mutex_destroy(&audio->monitoring_mutex);
memset(audio, 0, sizeof(struct obs_core_audio));Those mutexes are initialised only in obs_init_audio(), i.e. only after audio was successfully opened. A reset with oai == NULL before that therefore destroys zeroed memory. Linux's glibc pthread_mutex_destroy on a zeroed mutex is harmless, which is why Rust Tier 2 Linux (tests ON) passes on the same commit; on Windows libobs links a pthreads-win32 layer where the same call can fault, and GROUP TEARDOWN (obs_shutdown → obs_free_audio again) reports the same exception 11.
Not verified: there is no Windows host here, so this is code reading, not a debugger stack. A cdb/dump trace of the failing binary would confirm the frame.
Acceptance criteria
test_core_setup_rules_stepspasses inBuild 🧱 / Rust Tier 2 (windows-2025-vs2026), andBuild 🧱 / Rust Tier 2 Linux 🐧 (tests ON)still passes.obs_free_audio()is safe when the audio core was never opened: destroy only mutexes thatobs_init_audio()initialised (an explicit initialised flag, or an early return whenaudio->audio == NULLand no init has happened) — not by deleting theobs_reset_audio2(NULL)case, which the test pins as a success.- No behavior change for the normal
obs_shutdownafter a real audio open. - A regression test is not required on Linux for this fix: the failure is Windows-only, so the Windows lane is the RED → GREEN evidence and the PR body should say so.
No docs/features.md line: internal lifetime fix, no user-visible behavior.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 29, 2026
Claiming: #2910 — make
obs_free_audio()safe when the audio core was never opened.obs_reset_audio2(NULL)before any successfulobs_reset_audio2(info)returns true and leaves the core reusable (it must not depend on destroying uninitialised mutexes). It passes on Linux today, so the RED evidence for this issue is the Windows job123456184550, quoted in the body; the Linux case is the characterization that keeps the fix honest.obs_init_audio()initialised the mutexes and destroy them only then, soobs_free_audio()is idempotent for a cold core.obs_shutdownafter a real audio open is unchanged.Build 🧱 / Rust Tier 2 (windows-2025-vs2026)green plusRust Tier 2 Linux 🐧 (tests ON)green on the PR; nodocs/features.mdline (internal lifetime fix).First PR: within this tick, work in this checkout (
~/dev/obs-rust/obs-studio5), branchfix/2910-free-audio-cold-core.zackees commentedon Oct 29, 2026
Closing note: what fixed it, and what is left.
Fix —
a32bad067(PR #2911).struct obs_core_audiocarriesmutexes_initialised, set byobs_init_audio()only after both mutexes exist;obs_free_audio()destroys them only when it is set, and the existingmemsetclears it so a later open re-arms it.obs_init_audio()now also destroys the monitoring mutex when the task mutex fails, instead of leaking it.Evidence — the Windows Tier 2 lane, which this PR's own scope does not select, run on demand:
scheduled.yamldispatch on the branch, run40879828636, job123474622500→ success,100% tests passed out of 327,test_core_setup_rules_stepspassed in all three repeats. Locally the same tree passed the full gate (lint, rust-test 523 s, cross 243 s, tier2-linux 2507 s, 610/610 cmocka in the container).Left over — the scope rule that let this class through: nothing in
ci/ci_scope.pyputs alibobs/-only diff in the Windows lane, so a Windows-only crash is unobservable from the PR that causes it. Filed as #2916 with the three options and the cost of each.fix(libobs): only destroy the audio mutexes obs_init_audio created (o…
ci(scope): a core master push runs the macOS and Windows Rust lanes (o…