Skip to content

test/cmocka: Capture the Windows scene teardown fault in-process (#2547) - #2550

Closed
zackees wants to merge 3 commits into
masterfrom
fix/2547-windows-scene-dump
Closed

zackees wants to merge 3 commits into
masterfrom
fix/2547-windows-scene-dump

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Refs #2547

RED commit d277df2 adds an opt-in repro of the Windows-only scene/canvas characterization and a vectored exception handler that writes a minidump from the original faulting process. The normal Windows test remains skipped as in #2545. The Cargo-core Tier 2 validator runs the focused repro up to 30 times and analyzes the dump with cdb if it fails.

Evidence before this PR: #2545 Windows Tier 2 crashed in both Cargo-built cores (runs 40429363810, 40436320792, 40439283995); CMake cores passed, WER made no dump, and isolated cdb reruns did not reproduce. This draft PR is expected to be RED until the faulting stack is captured and the cause is fixed. Linux lint passed; Tier 2 and Windows CI pending. Do not merge the diagnostic-only revision.

)

Prior Windows Tier 2 runs crashed in the Cargo-built cores but WER produced no dump and isolated debugger reruns passed. Keep the normal Windows skip, enable a focused repro only in the Cargo suites, and write a minidump from the faulting exception context before CTest sees the crash. This diagnostic PR is expected to fail until the root cause is fixed.
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Diagnostic result on run 40447423147: the Windows characterization ran 30 focused repeats against each Cargo-built core and all 60 passed; the four ordinary suite runs skipped it as intended. This matches the earlier isolated cdb reruns, not the three full-suite failures. Next I will enable the opt-in case during the full Cargo CTest suites, preserving the rest of the test plan, so the crash handler sees the failure in its original context.

Sixty isolated repeats passed on #2550. Enable the opt-in scene characterization during each complete Cargo CTest run, with three full-suite repeats if the first passes. Keep the in-process dump handler active for the original failing context.
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Linux local Tier 2 completed: 574/574 passed in each build; two focused repeats of the scene test passed in each. Commit 3d7cb0a moves the opt-in Windows repro from isolated focused repeats into each full Cargo CTest suite (with up to three full-suite repeats if needed), where the prior failures occurred. Lint passed. The PR remains draft and intentionally RED if it captures the crash.

The in-process vectored handler perturbed the Windows repro: eight full Cargo suite runs passed. Remove the handler, preserve the opt-in case, and configure WER LocalDumps under HKLM for the original process. The prior HKCU key did not produce a dump on CI.
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Run 40452146768 passed four full Cargo CTest suites per core with the in-process vectored handler. That handler and DbgHelp linkage may perturb the timing. Commit 34885c5 removes that instrumentation and configures Windows Error Reporting LocalDumps under HKLM (the documented machine key) while keeping the opt-in case active in the full Cargo suites. Normal Windows behavior remains skipped outside this diagnostic. Lint passed; watching for a crash dump or compiler failure.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Windows diagnostic CI on run 40452146768 completed: both CMake suites and the Cargo OBS suite with the in-process scene repro passed; the Cargo suite retried the focused scene case three times, each passing (0.04–0.06 s). No faulting stack or dump was produced. The earlier crash remains unexplained, so this draft stays diagnostic only and is not ready to merge. Next step is to compare the failing #2545 full-suite order and environment with this run before another instrumentation change.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Captured original WER stack in run 40454928969, job 122031355159: https://github.com/obs-rust/obs-studio/actions/runs/40454928969/job/122031355159 . Fault: pthread_mutex_unlock at pthread_mutex_unlock.c:61 with a null handle, called by obs_source_destroy_defer at obs-source.c.h:800 through obs_context_wait, then the Rust task worker. The active case was canvas_scene_remove_and_move; both move canvases were already destroyed. Source inspection indicates moving the scene overwrites its context mutex with the destination canvas mutex. Deferred destruction then accesses it after canvas release, whereas video ticks use the global source UUID mutex. Plan: an event-synchronized regression holding the obsolete canvas mutex, plus a worker-gated case freeing canvases before deferred source destruction; then synchronize destruction with the global source mutex and restore Windows coverage. Automatic write approval rejected creation of test/cmocka/test_canvas_source_destroy_mutex.c as a protected settings write, despite no settings being involved. No code was changed or pushed; this diagnostic PR remains draft.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Superseded. #2547's root cause was found and fixed by #2581 (libobs: Restore the global source wait mutex when a canvas goes away), merged 2026-10-27, and #2547 is closed.

This draft existed only to capture the Windows faulting stack in-process. That evidence was obtained from run 40454928969, job 122031355159 (WER dump: null-handle pthread_mutex_unlock from obs_source_destroy_defer via obs_context_wait), which is exactly what #2581 cites to justify restoring context.mutex to the global source mutex in obs_canvas_remove_source/obs_canvas_destroy. The diagnostic instrumentation (vectored handler, HKLM LocalDumps, the opt-in case inside the full Cargo suites) is no longer needed and is intentionally RED, so it should not merge.

Closing the draft rather than merging. Nothing here is lost: the repro analysis lives in the comment trail above and in #2581.

@zackees zackees closed this Oct 27, 2026
@zackees
zackees deleted the fix/2547-windows-scene-dump branch October 27, 2026 09:03
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Closing as superseded — the diagnosis this draft exists for is done and the fix has landed.

This revision is diagnostic only (it says so in the description) and must not be merged. The one thing #2547's acceptance asked for that is still open is the Windows Tier 2 run of the restored characterization — the merge-queue run for #2581 skipped every Windows lane. That is tracked by #2586, where the header fix's PR will be the first Windows Tier 2 run.

Nothing is left to do in this branch.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Closing this diagnostic draft as superseded. The fault it was built to capture is fixed: run 40454928969 job 122031355159 produced the stack (pthread_mutex_unlock via obs_source_destroy_defer with a null handle, after both move canvases were destroyed) and #2581 landed the fix on master — restore the global source mutex when a source leaves a canvas — with a deterministic regression case in test_canvas_destroy_scene_refs; #2547 is closed. Keeping an intentionally-unmergeable draft that no longer applies to master only adds queue noise. The in-process dump and WER LocalDumps harness stays reachable in the branch (fix/2547-windows-scene-dump, 34885c5) if a Windows fault ever needs capturing again. Follow-up for the one thing #2581 left unchecked is #2586 (its PR #2587 runs the restored characterization on Windows for the first time).

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.

1 participant