Skip to content

Diagnostics: native crashes, early crash log, report keeps the file - #3

Merged
Qwinty merged 1 commit into
mainfrom
claude/diag-crash-fixes
Sep 29, 2026
Merged

Qwinty merged 1 commit into
mainfrom
claude/diag-crash-fixes

Conversation

@Qwinty

@Qwinty Qwinty commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1, closing the gaps found when reviewing it.

What changes

  • Native crashes leave a trace. The panic hook only saw Rust panics, while the likely crash in this app is an access violation in Media Foundation, D3D11 or Win32. An unhandled-exception filter now writes last-crash.log with the exception code, address and module (native exception 0xC0000005 at 0x… in mfplat.dll), then the in-memory log. It allocates nothing (the heap may be broken), then calls the previous filter and lets Windows Error Reporting run as before.
  • Crashes before setup are kept. diag::init works out the log folder itself (logs\ next to portable data, or %LOCALAPPDATA%\io.github.plugcam\logs like Tauri's app_log_dir) and creates it. A test checks the identifier against tauri.conf.json.
  • The crash handlers wait for the logger lock (up to 100 ms) instead of dropping the crash when another thread is mid-line.
  • The report keeps the detailed log after it is turned off. Before, turn on → reproduce → turn off → Save report lost the file. Now the report has plugcam.log whenever it exists (titled with when it was last written), plus this session's lines from memory.
  • detailed log off goes into the file before it closes, so the file shows where it ends.
  • The report lists each GPU once (DXGI listed the Radeon 780M twice here).

Checks

  • cargo test --lib: 57 passed (4 new); cargo clippy --all-targets: no new warnings.
  • Crash probe (a throwaway example, not committed) with LOCALAPPDATA pointed at a temp folder: a null write produced native exception 0xC0000005 at … in zz_crash_probe.exe plus the buffer; a thread panic produced the panic and the buffer.
  • Real app (portable debug build, driven through WebView2 DevTools): Settings → Diagnostics renders; turning the detailed log on creates plugcam.log with the session's earlier lines; off writes the last line; Save report writes the file to Downloads with both log sections, one GPU, the phone serial masked (***e2d7, including the Wi-Fi ADB mDNS names) and no profile path.

CI can't run at the moment: GitHub reports the account is locked due to a billing issue.

… file

- An unhandled-exception filter writes last-crash.log for native crashes
  (access violations in Media Foundation, D3D11 and the like) with the
  exception code, address and module. It allocates nothing and hands on
  to the previous filter and Windows Error Reporting.
- The log folder is known and created from diag::init, so a crash before
  Tauri's setup is kept too; crash handlers wait up to 100 ms for the
  logger lock instead of giving up at once.
- The report takes plugcam.log whenever it exists, so a problem caught with
  the detailed log on is still there after it is turned off, plus this
  session's lines from memory.
- "detailed log off" is written before the file closes.
- The report lists each GPU once.
@Qwinty
Qwinty merged commit 1309e35 into main Sep 29, 2026
1 of 2 checks 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