loader(native): take the VICTORY_DUMP_THREADS=0 dump at an unhandled access violation too #59
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!59
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/59/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sandile-0511 on GitHub · 2026-11-26 11:35 UTC · original
Sandile-0511:fix/thread-dump-at-fatal-fault→main· +222 −35 · 4 files · 2 commits · merged 2026-11-26 12:58 UTCWhat this changes
VICTORY_DUMP_THREADS=0dumps every thread at the title's first breakpoint. The title's fatal-error path writes to address 0 instead (the watchdog crash in #15 atimage+0x23cf683), and when that happens varies by tens of seconds between runs, so a timed dump misses it. With=0the dump is now also taken at the first access violation that no handler takes.After review this also changes how every dump is collected:
collect()took the unwind-table mutex and allocated while a peer was suspended, so a peer stopped inside an unwind lookup or the allocator hung the dump. That hazard is onmainfor the timed and breakpoint dumps too.report_at_breakis replaced byreport_at_fault(code, unhandled)with an atomic claim. The report runs on its own thread, as the timed dump does, and the faulting thread waits for it for at most 60 s.Known limits: the stack copy is capped at 1 MiB; a long
VICTORY_FIND_QWORDscan can be cut short by the 60 s wait; a fatal write that one of the title's own handlers catches without a further unhandled fault would not trigger the dump.How it was tested
cargo test --target x86_64-apple-darwin -p victory-loader: 19 passed, 0 failed, 3 ignored (16 before). New tests:a_handled_access_violation_leaves_the_dump_for_the_fatal_one,a_thread_holding_the_unwind_tables_is_snapshotted_and_let_go(fails with a timeout if an unwind lookup is put back under suspension),the_chain_is_unwound_from_the_copied_stack.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings(clean, run on a Mac)cargo xtask policydispatch.Checklist
VICTORY_*variable and documented (existing switch; docs/native-host.md updated)@LakshanSivakumar on GitHub · 2026-11-26 11:51 UTC · original · requested changes
=0still gates the dump, and the call is after signal return. The blocker is thatcollect()can suspend a peer holding the unwind-table mutex (seh/unwind.rs~32–35) and then wait for that same mutex. Please keep the exception trigger nonblocking and resume peers before unwinding or formatting their snapshots. Also pin down the first-chance behavior in a synthetic test: a handled access violation can currently use up the dump before the watchdog fault.@Sandile-0511 on GitHub · 2026-11-26 12:30 UTC · original
You were right on all three points, and the first two are on
mainfor the timed and breakpoint dumps as well. Changes:Tests: a pure test of the claim decision, one where a thread holds the unwind tables while it is snapshotted (it times out if a lookup is put back under suspension), and one that unwinds from a copied stack. I also ran the game on this branch: the dump was written at the unhandled fault and the process ended as before.
Limits: no test drives a real fault through
dispatch, the stack copy is capped at 1 MiB, and a fatal write that the title's own handler catches without a further unhandled fault would not trigger the dump. This grew well past the original five lines, so if you would rather take the collection change as its own PR, I can split it. I updated the title and description to match.@LakshanSivakumar on GitHub · 2026-11-26 12:48 UTC · original · approved these changes
Thanks: no lock or allocation while peers are suspended, the trigger is nonblocking and the claim logic is tested. Approved. Follow-ups:
a_thread_holding_the_unwind_tables_is_snapshotted_and_let_goonly testssnapshot(), so add a test throughcollect()(or a comment); and say in the dump when the all-or-nothing stack copy fails, so an empty chain isn't silent.