fix(crash): the crash report's graphics card has its driver, and a start-up crash has a renderer #1714
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1714
Loading…
Reference in a new issue
No description provided.
Delete branch "jabbaxipil/Longshot:crash-report-gpu-driver"
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?
Type: fix · Risk: low · Tested on: Linux (Ubuntu 26.04.1), RTX 4070 · Needs: Windows, any GPU (a build)
TL;DR
A crash report sent with Report automatically named the graphics card without its driver, and said the renderer was "not known" when the crash happened while the shaders were being loaded at the start. This PR sends the card together with its driver and makes sure a start-up crash names its renderer. A check that fails on main passes here, and a start of the game built from this branch logs the lines in the new order.
Breakdown
Why
Two fields of the automatic crash report did not hold what the description and the docs say they hold.
gpuhad no driver, so the same card became two values (older reports had "name, driver") and a GPU crash could not be split by driver.rendererwas "not known" for a crash during the start-up shader preparation, a common place to crash. Fixes #1263.How to reproduce
Seen on: any; read from the code and the check's helper, as #1263 describes.
Settings and switches: defaults.
Steps: on main, feed the crash window's test helper a log with
vk: NVIDIA GeForce RTX 3090, Vulkan 1.4, ...; mesh shaders yes,vk: driver: NVIDIA 580.95.05andreport: gpu NVIDIA GeForce RTX 3090, NVIDIA 580.95.05, and press Report automatically, Send.Expected:
"gpu": "NVIDIA GeForce RTX 3090, NVIDIA 580.95.05".Actual:
"gpu": "NVIDIA GeForce RTX 3090". For the renderer: in a log of main,report: renderer Vulkancomes after the renderer's start, so a log that ends during the shader preparation has none.What changed
The helper now reads the renderer's own
report: gpuline, which it never read, and the report uses it. The host logsreport: rendereronce the Vulkan back end is loaded instead of after it has started.hos_crash_log_line()inhost/hos_crash_dialog.hkeeps thereport: gpuline (gpu_report); the newhos_crash_gpu()gives that line, else the device chosen and itsvk: driver:line joined the same way ("name, driver"), else the name alone.build_report()inhost/hos_crash_dialog.cuses it for the JSON'sgpuand the page's "Graphics card" line.report_facts()(the manual report) is unchanged.rx_start()inhost/rx_backend.clogsreport: renderer Vulkanbeforer->start(hwnd), which prepares the shaders.docs/crash-report-window.mdsays where both lines come from.tests/test_crash_dialog.pyasserts the postedgpu, the page's line, the three fallbacks and the last-line rule, and thatrx_startlogs the renderer before the start.Measurements
Verdict: nothing to measure: the change is to what the crash helper reads from a log after the game has ended, and to where one log line is written.
Flags and settings
None.
Testing
Tested: Linux (Ubuntu 26.04.1, kernel 7.0), RTX 4070, NVIDIA 615.71.09, Ryzen 7 5800X3D. The game run and the whole check run were at 6dec62c7 on main
47430e81; the branch was then rebased onto main4fc22424(two commits later, neither touching these files; the patch is unchanged bygit range-diff) and is2bc52134.nx2/make_game.py, tools.lock's Linux tools), started without a window and left on the title screen for 75 s (no save loaded, no play), 19,559 frames, no crash, no fatal line, no driver error. I looked at its last picture: the title with Continue, New Game and Options. Its log, in order: Line 74 is wherereport: rendererwas written on main. The timed run was ended by the test harness, not by the game.gpu"NVIDIA GeForce RTX 4070, NVIDIA 615.71.09" andrenderer"Vulkan".python -I -B tests/test_crash_dialog.py: passes, at 6dec62c7 and again at2bc52134after the rebase (withtest_no_webgpu,test_doc_anchors,test_crash_groupsand main's newtest_translator_stamp_text: 5 passed). With thehos_crash_dialog.cchange taken out it fails (the card with its driver: 'NVIDIA GeForce RTX 3090'); with therx_backend.cchange taken out it fails on the order.python -I -B tests/run_all.py --jobs 8: 678 passed, 38 failed, 109 skipped, at 6dec62c7 and on main47430e81, the same 38 (not run again after the rebase):test_bug_report_defaults,test_bug_report,test_capture_read_once,test_crash_groups,test_crt_options,test_damage_debug_menu,test_dev_packs,test_display_startup_failure,test_dlss_feature_size,test_failed_compile_keeps_objects,test_guest_imported,test_hardware_report,test_high_fps_fixes,test_host_guest_writes,test_hud_layout_row,test_invalidate_quick,test_libc_hooks,test_linux_preflight,test_linux_pressure,test_linux_update,test_log_open_failure,test_missing_nup,test_mods_size_table,test_pending_guest_import,test_pipeline_play_cache,test_prepare_cache_save,test_present_thread,test_profiling_mode,test_psychov35_fsr3_fg,test_readback_timeout_source,test_run_all_changed,test_slow_frames,test_song_note_cue,test_switch_table,test_upscaler_rows,test_vcore_escape,test_walk_key, andtest_vbytes(timeout at 600 s).Not tested:
--prepare-shaders.rx_prepare_shaders()(the build's own step) logs noreport: renderer; unchanged.Must be tested:
python -I -B tests/test_crash_dialog.pyto pass (by hand: the build's output and the check's last lines).Risks
What could break: a report's
gpuis longer than before (it is cut at the same 200 characters). If a log'sreport: gpuline and its chosen device ever disagreed, the report would carry thereport: gpuline. A start in which the Vulkan back end loads but does not start now hasreport: renderer Vulkanin its log; the lines that say it did not start are unchanged.Turning it off: revert the commit.
Compatibility: Nothing changes for a player. For whoever reads the reports:
gpuvalues gain the driver again, as the earlier reporter sent them.Issues
Fixes #1263
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.Tested in game: Linux (Ubuntu 26.04.1), RTX 4070, NVIDIA 615.71.09: a build of this branch at 6dec62c7 (before the rebase onto
4fc22424; the patch is unchanged) started without a window and left on the title screen for 75 s, 19,559 frames, no crash and no driver error. Its log hasreport: gpu NVIDIA GeForce RTX 4070, NVIDIA 615.71.09at line 34 andreport: renderer Vulkanat line 37, before the pipeline cache is read (line 46) and the precompile line (70);rx: renderer: Vulkan, where the report line was written before, is at line 74. No save was loaded and nothing was played.Looks ready from the code and the evidence. Two small suggestions are in the line comments. Neither blocks.
The parsing. The new
report: gpuline is read the same way as thereport: os,cpuandrendererlines next to it. It is astrstron"] ", thenhos_crash_take, which stops at the buffer's size and at\r/\n, so a Windows log with CRLF endings reads the same as a Linux one. A missing line, an empty one or a cut-off one gives""or a shorter value, and the helper does not crash.hos_crash_gpucannot overflow.gpu_report[328]holdsgpu[160] + ", " + driver[160], andbuild_report's buffer is the same size. The sent value is still cut atHOS_CRASH_MAX_GPUbyput_field. The four cases (the line, the device and its driver, the name alone, nothing) are all covered by the new asserts.Privacy. Nothing new leaves the PC. The value is the card's name and its driver's name and version from
VkPhysicalDeviceDriverProperties. It is the same data the manual report already sends, and older automatic reports sent it too. It goes through the same clean-up as before: the log line is redacted before parsing, andput_field/hos_crash_cleanremoves the home folder, the user name and the microphone names.The renderer line. Moving
report: renderer Vulkanbeforer->start(hwnd)is right for a crash during the shader preparation. When the Vulkan back end loads but fails to start, the report now says "Vulkan" instead of "not known". The log's "could not start" line still setsf->vulkan, so the stage and the verdict don't change. The Risks section says this.rx_startcan run more than once (HOS_HEADLESS), which only writes the same line again, and the last line is the one that counts.Measurements: "nothing to measure" is fine here. The change is in what the crash helper reads after the game has ended, plus one log line moved earlier in the start, with no per-frame cost. The author ran a build of this branch in the game on Linux with an RTX 4070, and the log shows the new order (renderer at line 37, the shaders loading from line 46). The new check fails on main with each half of the fix taken out. Still open, as the PR says: a Windows (llvm-mingw) build. The C is the same on both platforms, so I see little risk there.
@ -414,1 +414,4 @@const MkwVkRenderer *r = load_vulkan(dll);/* (the crash report's renderer: host/hos_crash_dialog.h. Before start(), which prepares the shaders: a crash in thereis a crash of this renderer too) */if (r) hos_log("report: renderer Vulkan");Fine as it is. One note: a start where the Vulkan back end loads but
start()fails now reports "Vulkan" as the renderer (the one that was tried). The stage still comes from the "could not start" line, so this only changes the field's value. If you'd like the docs to say so, one clause indocs/crash-report-window.mdwould cover it ("the back end chosen, whether or not it started").@ -384,2 +387,4 @@dialog = (ROOT / "host/hos_crash_dialog.c").read_text(encoding="utf-8")backend = (ROOT / "host/rx_backend.c").read_text(encoding="utf-8")# (the crash report's renderer is logged before the back end's start(), which prepares the shaders: a crash in there has one)start = backend[backend.index("int rx_start(void *hwnd) {"):]Nit: a new check cuts with
tests/srccut.py(AGENTS.md), which names the source and the marker ifrx_startis renamed or reshaped. For examplestart = between(backend, "int rx_start(void *hwnd) {", "\n}\n")(orblock(backend, "int rx_start(void *hwnd) {")), withsys.path.insert(0, str(Path(__file__).resolve().parent)); from srccut import block, betweenat the top.