Repository navigation
fix(desktop): break renderer crash loops with a guarded GPU-fallback relaunch - #2640
Merged
Merged
Conversation
A renderer that crashes deterministically at startup (GPU driver or cache corruption, issue #2595) turned the automatic recovery into an infinite loop: did-finish-load never fires, so the hidden main window is never shown, and recoverRendererAfterGone reloads every 2s until the user force-quits. A plain reinstall does not help because the corrupt state lives in userData. Recovery now counts consecutive crashes with no successful load in between and stops reloading after five: the first trip relaunches the app once with --disable-gpu (the classic mitigation for corrupt GPU state), guarded by a userData marker so a loop that survives the fallback surfaces a localized dialog instead of relaunching forever. Boot reads the same marker to disable hardware acceleration for manual launches too, and a run that stays loaded for ten minutes clears it again. Successful loads reset the streak, so scattered crashes over a long session never trip the breaker. The dialog offers opening the log folder (where the rendererProcessGone diagnostics already land) or quitting; strings are added to all nine locales.
…ed to this branch)
… — run 45817156730)
Review of #2597 found that every did-finish-load started a marker-clearing timer that no crash, close, or reload cancelled, so a fallback boot could clear the marker while the renderer was crashing again. A marker write failure also threw out of the crash callback, losing the only exit path, and the boot-time hardware acceleration check ran in index.ts after the async storage bootstrap, possibly after ready, where it has no effect. A per-window controller now owns one healthy-uptime timer for the current renderer and cancels it on crash, newer load, escalation, and close. A failed marker write logs and shows the terminal dialog instead of relaunching without a guard. Relaunch and dialog quits go through the confirmed ordered shutdown instead of app.exit. The marker lives in userData and is read in installation.ts, which runs before ready. An Electron E2E forces renderer crashes on every load and proves one guarded relaunch, a second failing launch reaching the dialog, and a stable fallback boot clearing the marker. GPU state is not claimed as the #2595 root cause. Refs #2595
Deploying pi-desktop with
|
| Latest commit: |
1949d88
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://15829e39.pi-desktop.pages.dev |
| Branch Preview URL: | https://fix-renderer-crash-loop-take.pi-desktop.pages.dev |
zergfff
added a commit
to zergfff/PI-Desktop-fork
that referenced
this pull request
Nov 30, 2026
Ported from vastsa/PI-Desktop v0.24.0-beta.7 (bug fixes only; the release's features were left for a later rebase): vastsa#2625 quarantine rejected outbox appends instead of retrying them forever vastsa#2574 settle live turns and tool rows when the sidecar dies mid-stream vastsa#2578 native Pi turns stay stoppable after a reload vastsa#2634 the task badge mirrors work that is still running vastsa#2639 let Arabic and Hebrew paragraphs choose their own side vastsa#2640 stop a renderer crash loop with one GPU-less relaunch, then a dialog vastsa#2642 reject differing spellings of one tool argument vastsa#2655 compaction summaries open on demand in the transcript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2595. Supersedes #2597 and keeps @SeanLiu326's commits and authorship; the follow-up commit addresses the review on #2597.
Problem
A renderer that crashes before
did-finish-loadon every startup is reloaded every 2 s forever. Theshow: falsemain window never appears (#2595 diagnostics: 10 000+renderer.process.goneper day).Fix
From #2597: after 5 consecutive crashes with no successful load in between, recovery stops reloading. The first trip relaunches once without hardware acceleration, guarded by a marker. If the loop survives that, a localized dialog offers the log folder or quit.
Review fixes in
e6d7c1e59:renderer-crash-loop.ts) owns a single healthy-uptime timer for the current renderer. It is cancelled on crash, a newer load, escalation, and window close. The marker is cleared only after 10 min of continuous uptime from one renderer.errorand shows the terminal dialog instead of relaunching without a dedup guard. A corrupt marker counts as spent and reading it never throws or rewrites.ready. fix(desktop): break renderer crash loops with a GPU-fallback relaunch #2597 calleddisableHardwareAcceleration()inindex.ts, which loads only after the async storage bootstrap and may run afterready, where the call has no effect. The marker now lives inuserDataand is read ininstallation.ts, synchronously beforeready.before-quitteardown) instead ofapp.exit(0), so host-core and running turns are settled.bootstrap/renderer-crash-loop-window.ts;window.tsgrows by 11 lines andindex.tsis unchanged.Verification
Task candidate
e6d7c1e59on baseorigin/main6214e5583, macOS arm64, Electron 43.6.0.node scripts/e2e-renderer-crash-loop.mjs: 11/11 PASS (new). Three launches on one isolated profile, with every main-window load forced to crash (forcefullyCrashRenderer):relaunch-disable-gpuis logged, and the exit goes throughapp.shutdown.app.relaunch,dialog.showMessageBox, and the 10 min timer duration are patched in Main by the script only.renderer-crash-loop.test.mjs(new, real fs + controlled timers) andrenderer-recovery.test.mjs: 17/17. Covered: a stale timer after a crash, a reload restarting the window, dispose, a marker write failure, a corrupt marker, and re-arm after a load.Desktop typecheck,
biome lint,check-architecture,docs:check,check:pr-base: pass.Spec:
03-runtime/07-process-model.mdcrash policy row andE2E-RENDERER-crash-loop-fallback.Not verified: the reporter's Windows / RTX 4060 Ti setup. Forced crashes reproduce the reload loop, not its original trigger.