Repository navigation
feat(exit-watchdog): the helper names the DLL a hang in ExitProcess waits in (#4589) - #4891
Merged
Merged
Conversation
The helper ends a hang inside ExitProcess, but its line names no library: it has neither the #4549 table nor the armed thread. Part 4 hands both over at arm time through a section the helper gets at start. - args_read_every_value / args_without_a_good_table_have_none: the helper reads the section handle from OBS_EXIT_WATCHDOG_TABLE; it is optional, a bad value means none. - the_armed_thread_and_the_table_read_back, a_cut_or_damaged_section_reads_as_nothing: encode_arm/decode_arm (stubs) round-trip the thread id and every owner kind; a cut, empty or damaged section reads as nothing. - windows::the_helpers_line_names_the_dll: a child arms the helper with a table that marks the test executable as loaded by blocker.dll, then blocks in ExitProcess (its TLS callback); the helper's line must name the executable and blocker.dll (x64). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aits in (#4589) The helper ended a hang inside ExitProcess (a DLL's detach), but its line named no library: it had neither the #4549 table nor the thread. - At start, OBS also hands the helper an unnamed 1 MiB section, in the same explicit handle list (OBS_EXIT_WATCHDOG_TABLE); the process handle it gets adds PROCESS_VM_READ | PROCESS_QUERY_INFORMATION. - arm() writes the table and the calling thread's id into the section (encode_arm: a magic, the thread, then each entry's range, owner and names), then sets the event. Without a section the helper works as before. - On timeout, while OBS still runs, the helper reads the section (decode_arm), opens and suspends that thread, reads its registers and walks its stack with dbghelp's StackWalk64 (loaded at run time, as libobs/obs-win-crash-handler.c.h does), then writes the line naming the first frame's library outside OBS, and ends OBS. x64 only for the walk; arm64 Windows still writes the line without a library. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4589
Part 4, the last part of the plan in the claim: the helper process names the DLL that a hang inside
ExitProcesswaits in. Parts 1–3 are #4858, #4859 and #4890.Problem
When a plugin DLL blocks in its
DLL_PROCESS_DETACH(a static destructor, insideExitProcess), the helper ended OBS, but its line named no library. It had neither the #4549 table nor the thread to walk. Example: Advanced Scene Switcher's sub-plugins in #3739.Change
rust/obs-exit-watchdog:helper.rs, portable):encode_arm/decode_armwrite and read the armed thread's id and the table. The format is a magic, the thread id, then each entry's range, owner tag and names.HelperArgsreads the optional section handle fromOBS_EXIT_WATCHDOG_TABLE.platform/windows_helper.rs):CreateProcessWthe section is made non-inheritable, as the event already is.PROCESS_VM_READ | PROCESS_QUERY_INFORMATION.arm()writes the table and the calling thread's id into the section, then sets the event.helper.rs,platform/windows_stack.rs): on timeout, while OBS still runs, the helper:StackWalk64over OBS's memory (dbghelp is loaded at run time, aslibobs/obs-win-crash-handler.c.hdoes);docs/features.md: the "names the plugin" entry now covers a DLL that blocks while Windows unloads it.Tests
All runs were on a Windows 11 VM (x64, MSVC), with
soldr cargo test -p obs-gpu-status --test obs-tests-gpu exit_watchdog, on the commits after the rebase onto01c5c1ec4(#4890).76d8f066f:27 passed; 4 failed.args_read_every_valuefails: the section handle is not read yet.the_armed_thread_and_the_table_read_backanda_cut_or_damaged_section_reads_as_nothingfail on thetodo!()stubs. These two portable tests run on every host.windows::the_helpers_line_names_the_dllfails. A child starts the helper and arms it with a table that marks the test executable as loaded byblocker.dll. It then callsexiton that thread and blocks in its TLS callback insideExitProcess, which is the state of a plugin DLL's detach. The test expects the helper's line to name the executable andblocker.dll.a14c892e6:31 passed; 0 failed. The helper's line from that child:exit_watchdogtests, 0 failures, longest 1.56 s.clippy -D warnings --all-targetsforobs-exit-watchdogandobs-gpu-statusis clean onx86_64-pc-windows-msvc,aarch64-pc-windows-msvcand the macOS host;rustfmtis clean. arm64 Windows is compile-checked only.Tiers: Tier 1 only. This is new Rust host code with no C original, so Tiers 2–4 do not apply.
Test cost: the new portable tests take microseconds.
the_helpers_line_names_the_dllruns one child and one helper process for about 1 s (the timeout), as the existing helper tests do. The wholeexit_watchdoggroup takes about 1.6 s.Not checked: a full OBS build with a real plugin that blocks in its detach.
test/packaged-startup.py(part 2) checks that the helper ends a blocked quit; it does not check the DLL name.🤖 Generated with Claude Code