Skip to content

crash_diag: log silent Windows deaths (0xC000041D) to iris-crash.log - #96

Merged
techomancer merged 1 commit into
mainfrom
fix-crash-diag
Sep 8, 2026
Merged

crash_diag: log silent Windows deaths (0xC000041D) to iris-crash.log#96
techomancer merged 1 commit into
mainfrom
fix-crash-diag

Conversation

@techomancer

Copy link
Copy Markdown
Owner

The native CLI dies on some Windows machines during startup with exit code 0xC000041D (STATUS_FATAL_USER_CALLBACK_EXCEPTION) and no message: the fault happens on the stack of a Win32 callback (winit's wndproc), and 64-bit Windows re-raises any exception that escapes a kernel callback as that fixed status, discarding the original cause. The release profile is panic = "abort", so a Rust panic there also prints nothing useful. This is the shape of issue #94.

src/crash_diag.rs, installed first thing in main():

  • panic hook - runs even under panic=abort, before the abort; writes message + thread + location + backtrace.
  • Windows vectored exception handler - runs first-chance, before the callback dispatcher swallows the exception; logs the real code, faulting address and a module+offset stack for access violations, illegal/privileged instructions, stack overflow, heap corruption and the fatal-callback status itself.
  • Windows SetUnhandledExceptionFilter as a backstop.

Everything is appended to iris-crash.log and echoed to stderr. Dormant until something crashes - no steady-state cost (verified: no polling thread, no allocation, handlers only entered on an actual OS exception, never for Result::Err / None / release overflow).

Self-test: IRIS_CRASH_SELFTEST=panic|thread|segv. Escape hatch if the
VEH ever gets noisy: IRIS_CRASH_DIAG=off (panic hook stays).

rules/gui/windows-silent-exit-0xc000041d.md records the investigation: what 0xC000041D means, how to symbolize the report, and which re-entrancy theories were ruled out (vendored winit 0.30.13 buffers the re-entrant request_inner_size path; not reproducible on a desktop; not fixed upstream through winit 0.31-beta).

The native CLI dies on some Windows machines during startup with exit
code 0xC000041D (STATUS_FATAL_USER_CALLBACK_EXCEPTION) and no message:
the fault happens on the stack of a Win32 callback (winit's wndproc),
and 64-bit Windows re-raises any exception that escapes a kernel
callback as that fixed status, discarding the original cause. The
release profile is panic = "abort", so a Rust panic there also prints
nothing useful. This is the shape of issue #94.

src/crash_diag.rs, installed first thing in main():

  * panic hook - runs even under panic=abort, before the abort; writes
    message + thread + location + backtrace.
  * Windows vectored exception handler - runs first-chance, before the
    callback dispatcher swallows the exception; logs the real code,
    faulting address and a module+offset stack for access violations,
    illegal/privileged instructions, stack overflow, heap corruption
    and the fatal-callback status itself.
  * Windows SetUnhandledExceptionFilter as a backstop.

Everything is appended to iris-crash.log and echoed to stderr. Dormant
until something crashes - no steady-state cost (verified: no polling
thread, no allocation, handlers only entered on an actual OS exception,
never for Result::Err / None / release overflow).

Self-test: IRIS_CRASH_SELFTEST=panic|thread|segv. Escape hatch if the
VEH ever gets noisy: IRIS_CRASH_DIAG=off (panic hook stays).

rules/gui/windows-silent-exit-0xc000041d.md records the investigation:
what 0xC000041D means, how to symbolize the report, and which
re-entrancy theories were ruled out (vendored winit 0.30.13 buffers the
re-entrant request_inner_size path; not reproducible on a desktop; not
fixed upstream through winit 0.31-beta).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@techomancer
techomancer merged commit 8911c1b into main Sep 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant