DARNER_EXIT_AFTER_WORLD_S ends at once with frame generation on, as the menu quit does #491

Open
m3m3dub5 wants to merge 1 commit from m3m3dub5/fix-exit-after-world-terminate into Main AGit
First-time contributor

What it changes

  • The problem on main: with frame generation on, a run ended by DARNER_EXIT_AFTER_WORLD_S aborts while exiting. std::process::exit runs the DLLs' unloading while Streamline's frame-generation threads are still working, nvngx_dlssg.dll takes an access violation (read at nvngx_dlssg.dll+0x16c40), and the crash reporter's panic hook then calls std::thread::current() on a thread whose local data is already destroyed, which aborts ("use of std:🧵:current() is not possible after the thread's local data has been destroyed"). Seen in all four frame-generation benchmark runs on 2026-12-05 (RTX 5080, driver 32.0.16.2140); the frame-generation-off runs exited cleanly. The F1 menu's quit already avoids exactly this: host/menu.rs ends with TerminateProcess and says "std::process::exit runs the DLLs' unloading, which with Streamline loaded did not come back".
  • This makes the bench exit do the same: flush the log, then TerminateProcess(GetCurrentProcess(), 0) on Windows.

How it was tested

  • Tested revision: 71755aa (on d91d8e4)
  • Commands and results:
    • cargo xtask policy: 564 files ok.
    • cargo build --release --locked -p darner: compiles.
    • In game (RTX 5080, Series X profile, 2560x1440, DLSS quality, frame generation on, ray tracing off), DARNER_EXIT_AFTER_WORLD_S=30: before, 4 of 4 runs aborted as above; after, 1 run ended with no fault and no panic, the log ending at "ending the process 30 s after the world was first drawn".
  • Changes a default: no.
  • A/B result: not a default or speed change.
  • Gates run on that revision (the three in AGENTS.md; there is no CI): none; cargo xtask policy only.
  • Gameplay, when relevant: RTX 5080, Series X profile, 2560x1440, DLSS quality, frame generation on, ray tracing off.
  • Shader wave sizes tested, when relevant: not relevant (no shader change).
  • Hardware dependence: the abort was seen with DLSS frame generation on an RTX 5080; likely general to frame generation on NVIDIA, untested elsewhere.
  • Coverage gaps: one run after the change; not tested with FSR frame generation. The nvngx fault itself is NVIDIA's - this only avoids the teardown that runs while its threads work.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #476 (the benchmark runs where this was seen), #64 (the menu's abrupt exit), #28 (flushing the log before an exit)
  • Replaces or overlaps: none found
## What it changes - The problem on main: with frame generation on, a run ended by `DARNER_EXIT_AFTER_WORLD_S` aborts while exiting. `std::process::exit` runs the DLLs' unloading while Streamline's frame-generation threads are still working, `nvngx_dlssg.dll` takes an access violation (read at `nvngx_dlssg.dll+0x16c40`), and the crash reporter's panic hook then calls `std::thread::current()` on a thread whose local data is already destroyed, which aborts ("use of std::thread::current() is not possible after the thread's local data has been destroyed"). Seen in all four frame-generation benchmark runs on 2026-12-05 (RTX 5080, driver 32.0.16.2140); the frame-generation-off runs exited cleanly. The F1 menu's quit already avoids exactly this: `host/menu.rs` ends with `TerminateProcess` and says "std::process::exit runs the DLLs' unloading, which with Streamline loaded did not come back". - This makes the bench exit do the same: flush the log, then `TerminateProcess(GetCurrentProcess(), 0)` on Windows. ## How it was tested - Tested revision: `71755aa` (on `d91d8e4`) - Commands and results: - `cargo xtask policy`: 564 files ok. - `cargo build --release --locked -p darner`: compiles. - In game (RTX 5080, Series X profile, 2560x1440, DLSS quality, frame generation on, ray tracing off), `DARNER_EXIT_AFTER_WORLD_S=30`: before, 4 of 4 runs aborted as above; after, 1 run ended with no fault and no panic, the log ending at "ending the process 30 s after the world was first drawn". - Changes a default: no. - A/B result: not a default or speed change. - Gates run on that revision (the three in AGENTS.md; there is no CI): none; `cargo xtask policy` only. - Gameplay, when relevant: RTX 5080, Series X profile, 2560x1440, DLSS quality, frame generation on, ray tracing off. - Shader wave sizes tested, when relevant: not relevant (no shader change). - Hardware dependence: the abort was seen with DLSS frame generation on an RTX 5080; likely general to frame generation on NVIDIA, untested elsewhere. - Coverage gaps: one run after the change; not tested with FSR frame generation. The nvngx fault itself is NVIDIA's - this only avoids the teardown that runs while its threads work. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #476 (the benchmark runs where this was seen), #64 (the menu's abrupt exit), #28 (flushing the log before an exit) - Replaces or overlaps: none found
DARNER_EXIT_AFTER_WORLD_S ended the process with std::process::exit, which runs the DLLs' unloading while Streamline's frame-generation threads are still working: nvngx_dlssg.dll takes an access violation, and the crash reporter's panic hook calls std:🧵:current() on a thread whose local data is destroyed, which aborts.

The F1 menu's quit already ends with TerminateProcess for this reason (host/menu.rs's restart_as says so). Flush the log, then do the same.
m3m3dub5 changed title from host: end the bench exit at once, as the menu quit does to pr-fix][frame-generation][NVIDIA] DARNER_EXIT_AFTER_WORLD_S ends at once with frame generation on, as the menu quit does 2026-12-05 03:28:29 +00:00
m3m3dub5 changed title from pr-fix][frame-generation][NVIDIA] DARNER_EXIT_AFTER_WORLD_S ends at once with frame generation on, as the menu quit does to [pr-fix][frame-generation][NVIDIA] DARNER_EXIT_AFTER_WORLD_S ends at once with frame generation on, as the menu quit does 2026-12-05 03:28:48 +00:00
Contributor

I checked benchmark output at timed exit on Windows at 71755aab. A single-producer fixture drove the production Meter::frame through four synthetic frames. All five due-timer children exited with code 0. After each exit I could read all four rows from the benchmark CSV, including the frame that triggered exit, and the final marker from Darner’s asynchronous log.

Two of the five runs used native Rust PGO instrumentation. In both, the explicit LLVM profile writer returned 0 and llvm-profdata show read nonzero execution counts for exit_after_world. With the timer unset, the world threshold unreached, or the timer still pending, the call returned to the fixture in both builds. This checks output preservation on the timed path. The fixture ran without a game or a frame-generation backend.

I checked benchmark output at timed exit on Windows at `71755aab`. A single-producer fixture drove the production `Meter::frame` through four synthetic frames. All five due-timer children exited with code 0. After each exit I could read all four rows from the benchmark CSV, including the frame that triggered exit, and the final marker from Darner’s asynchronous log. Two of the five runs used native Rust PGO instrumentation. In both, the explicit LLVM profile writer returned 0 and `llvm-profdata show` read nonzero execution counts for `exit_after_world`. With the timer unset, the world threshold unreached, or the timer still pending, the call returned to the fixture in both builds. This checks output preservation on the timed path. The fixture ran without a game or a frame-generation backend.
First-time contributor

Tested merged onto c8258f95 (release), head 71755aab. RTX 3090 24 GB, driver 621.24, i5-10600K, 32 GB, Windows 11.

In addition to the fixture test above, a real run with frame generation on (DARNER_FRAMEGEN=1) and DARNER_EXIT_AFTER_WORLD_S=60, one run per build:

  • main: exit code 0, log ends with ending the process 60 s after the world was first drawn.
  • this PR: exit code 0, same line, no panic, access violation or abort in the log.

Only one run each, so a rare crash on exit would not show here.

AI-assisted testing (Claude Code, Claude Opus 5.5); results and text reviewed by me.

Tested merged onto `c8258f95` (release), head `71755aab`. RTX 3090 24 GB, driver 621.24, i5-10600K, 32 GB, Windows 11. In addition to the fixture test above, a real run with frame generation on (`DARNER_FRAMEGEN=1`) and `DARNER_EXIT_AFTER_WORLD_S=60`, one run per build: - `main`: exit code 0, log ends with `ending the process 60 s after the world was first drawn`. - this PR: exit code 0, same line, no `panic`, `access violation` or `abort` in the log. Only one run each, so a rare crash on exit would not show here. _AI-assisted testing (Claude Code, Claude Opus 5.5); results and text reviewed by me._
TrustNo1 changed title from [pr-fix][frame-generation][NVIDIA] DARNER_EXIT_AFTER_WORLD_S ends at once with frame generation on, as the menu quit does to DARNER_EXIT_AFTER_WORLD_S ends at once with frame generation on, as the menu quit does 2026-12-06 03:28:01 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/491/head:m3m3dub5/fix-exit-after-world-terminate'
git switch 'm3m3dub5/fix-exit-after-world-terminate'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'm3m3dub5/fix-exit-after-world-terminate'
git switch 'm3m3dub5/fix-exit-after-world-terminate'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'm3m3dub5/fix-exit-after-world-terminate'
git switch 'm3m3dub5/fix-exit-after-world-terminate'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'm3m3dub5/fix-exit-after-world-terminate'
git switch 'Main'
git merge --squash 'm3m3dub5/fix-exit-after-world-terminate'
git switch 'Main'
git merge --ff-only 'm3m3dub5/fix-exit-after-world-terminate'
git switch 'Main'
git merge 'm3m3dub5/fix-exit-after-world-terminate'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!491
No description provided.