diagnostics: freeze report on by default, code around a crash (no title bytes), Streamline repeats limited #3416

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "fix/crash-diagnostics:fix/crash-diagnostics"
git switch "fix/crash-diagnostics"
Open
leonida/mandy
MoonEyes wants to merge 2 commits from fix/crash-diagnostics into main

This pull request has changes conflicting with the target branch.

Merge manually to resolve the conflicts.

Conversation
Reviewers 0 approvals
  • No reviewers
Details

This pull request has changes conflicting with the target branch.

Merge manually to resolve the conflicts.

  • d3d12/docs/findings.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'fix/crash-diagnostics:fix/crash-diagnostics'
git switch 'fix/crash-diagnostics'
Member

Head: 61f33457ca (commits 3ae4212c8c, 61f33457ca), on main 5286146626.

Change. Three small diagnostics from Darner:

  1. leonida-gpu/src/stall.rs (Darner 98412e7, on by default since 1e521f0; Mandy had no freeze report): after 15 s without a frame shown, the log says once which threads used the CPU over 3 s, by name (one spinning, or all waiting). Hooked in Meter::frame; LEONIDA_STALL_REPORT=0 turns it off. A sleeping thread and one store per frame.
  2. leonida-loader/src/crash.rs (Darner b85fe68): a line on the code around the fault. No byte of the title's code is printed: for an address inside a title image (threads::in_title, never waits for a lock) the line gives the image offset only; where the images cannot be looked at it says so; elsewhere (our code, the system's) the 32 bytes before and 16 from the fault are printed, ?? for an unreadable part.
  3. leonida-gpu/src/streamline.rs (Darner 3e6c82f): a Streamline warning or error that repeats is logged the first time and every 1000th with its count (68,876 identical lines in one Darner log); 4096 distinct messages counted at most.

findings.md and switches.md updated.

Tests. stall.rs (2: the stall condition, the busiest thread first), crash.rs (3: both sides, a part that cannot be read, the title's bytes never in the line), threads.rs (1: lookup of an address in the images), streamline.rs (3: the 1, 1000, 2000 logging, the bound, the count in the line). cargo test -p leonida-gpu -p leonida-loader --locked: gpu 734 passed, loader 95 passed (Windows 11). test_d3d12_switches.py OK, check_no_game_data.py clean.

In-game run required. Not played. A normal 300 s run must show no no frame shown line and no code around the fault line; to see the freeze report, stall the window for over 15 s (a minimised window makes a false alarm, expected). The crash line needs a fault: check that a crash inside the title shows the offset line and no hex, and one in our code shows bytes. Streamline: run with frame generation and check the log for said N times so far.

Known follow-up (not in this change). The existing (code 0f 01 ..) for an illegal or privileged instruction (crash.rs, instruction_bytes, up to 15 bytes) prints title bytes when the title faults on such an instruction. It is older and useful (it names the console instruction), but it breaks the rule above; best gated by in_title in a follow-up. Also: stubs we generate outside the images (console_insn, write_sites...) count as "elsewhere"; none was found to embed title bytes, not verified.

AI-assisted. Written with Claude Opus 5.5 (orchestrating session) and Claude Sonnet 5.5 (the agent that wrote the code). Reviewed by a distinct read-only Claude agent (code-reviewer): first verdict REFUSED (the watcher thread read its clock from a OnceLock still being filled and could end at once, silently), fixed in the head, with two smaller findings (a second frame check before reporting, a test that no longer depends on the global images list); second look: ACCEPTED.

Credit. Darner (https://github.com/tyr0nsur/Darner): stall.rs (trustno1-coder, 98412e7, 1e521f0), crash line (b85fe68), Streamline limiter (3e6c82f), GPL-3.0-or-later as this repository, credited in stall.rs's header, the code comments and the commit message.

🤖 Generated with Claude Code

Head: `61f33457ca` (commits `3ae4212c8c`, `61f33457ca`), on main `5286146626`. **Change.** Three small diagnostics from Darner: 1. `leonida-gpu/src/stall.rs` (Darner `98412e7`, on by default since `1e521f0`; Mandy had no freeze report): after 15 s without a frame shown, the log says once which threads used the CPU over 3 s, by name (one spinning, or all waiting). Hooked in `Meter::frame`; `LEONIDA_STALL_REPORT=0` turns it off. A sleeping thread and one store per frame. 2. `leonida-loader/src/crash.rs` (Darner `b85fe68`): a line on the code around the fault. **No byte of the title's code is printed**: for an address inside a title image (`threads::in_title`, never waits for a lock) the line gives the image offset only; where the images cannot be looked at it says so; elsewhere (our code, the system's) the 32 bytes before and 16 from the fault are printed, `??` for an unreadable part. 3. `leonida-gpu/src/streamline.rs` (Darner `3e6c82f`): a Streamline warning or error that repeats is logged the first time and every 1000th with its count (68,876 identical lines in one Darner log); 4096 distinct messages counted at most. `findings.md` and `switches.md` updated. **Tests.** `stall.rs` (2: the stall condition, the busiest thread first), `crash.rs` (3: both sides, a part that cannot be read, the title's bytes never in the line), `threads.rs` (1: lookup of an address in the images), `streamline.rs` (3: the 1, 1000, 2000 logging, the bound, the count in the line). `cargo test -p leonida-gpu -p leonida-loader --locked`: gpu 734 passed, loader 95 passed (Windows 11). `test_d3d12_switches.py` OK, `check_no_game_data.py` clean. **In-game run required.** Not played. A normal 300 s run must show no `no frame shown` line and no `code around the fault` line; to see the freeze report, stall the window for over 15 s (a minimised window makes a false alarm, expected). The crash line needs a fault: check that a crash inside the title shows the offset line and no hex, and one in our code shows bytes. Streamline: run with frame generation and check the log for `said N times so far`. **Known follow-up (not in this change).** The existing `(code 0f 01 ..)` for an illegal or privileged instruction (`crash.rs`, `instruction_bytes`, up to 15 bytes) prints title bytes when the title faults on such an instruction. It is older and useful (it names the console instruction), but it breaks the rule above; best gated by `in_title` in a follow-up. Also: stubs we generate outside the images (`console_insn`, `write_sites`...) count as "elsewhere"; none was found to embed title bytes, not verified. **AI-assisted.** Written with Claude Opus 5.5 (orchestrating session) and Claude Sonnet 5.5 (the agent that wrote the code). Reviewed by a distinct read-only Claude agent (code-reviewer): first verdict REFUSED (the watcher thread read its clock from a `OnceLock` still being filled and could end at once, silently), fixed in the head, with two smaller findings (a second frame check before reporting, a test that no longer depends on the global images list); second look: ACCEPTED. **Credit.** Darner (https://github.com/tyr0nsur/Darner): `stall.rs` (trustno1-coder, `98412e7`, `1e521f0`), crash line (`b85fe68`), Streamline limiter (`3e6c82f`), GPL-3.0-or-later as this repository, credited in `stall.rs`'s header, the code comments and the commit message. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Three small diagnostics from the Darner fork (tyr0nsur/Darner,
GPL-3.0-or-later like this tree):

- stall.rs (98412e7, on by default since 1e521f0): after 15 s without a
  frame shown, the log says once which threads used the CPU over 3 s, by
  name (one spinning, or all waiting). LEONIDA_STALL_REPORT=0 turns it off.
  Mandy had no such report.
- crash.rs (b85fe68): the report gets a line on the code around the fault.
  Reports are posted in public, so for an address inside a title image the
  line gives the image offset and no byte (threads::in_title, which never
  waits for the lock); elsewhere (our code, the system's) the 32 bytes
  before and 16 from the fault are printed, ?? for an unreadable part.
- streamline.rs (3e6c82f): a warning or error Streamline repeats is logged
  the first time and then every 1000th, with its count (68,876 identical
  lines in one Darner log).

Unit tests for each; findings.md and switches.md updated. Not played.

Credit: Darner (trustno1-coder, 98412e7, 1e521f0, b85fe68, 3e6c82f).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
OreoFR referenced this pull request from a commit 2026-12-04 01:27:04 +00:00
OreoFR referenced this pull request from a commit 2026-12-04 01:27:04 +00:00
Sign in to join this conversation.
No description provided.