Skip to content

The agent that grows with you

fix(desktop): a GPU crash after a healthy NVIDIA boot takes no --disable-gpu relaunch either

Tekniumc739d5f94ad5
diff --git a/apps/desktop/electron/linux-gpu-fallback.ts b/apps/desktop/electron/linux-gpu-fallback.ts
index f2aa4ca26c9..e630b1e6f51 100644
--- a/apps/desktop/electron/linux-gpu-fallback.ts
+++ b/apps/desktop/electron/linux-gpu-fallback.ts
@@ -340,8 +340,10 @@ export function linuxGpuChildDeathPath(options: {
alreadySoftware?: boolean
sandboxRelaunchAttempted?: boolean
softwareRelaunchAttempted?: boolean
+ /** The GPU survived this boot's witness window; Chromium recovers a later death itself. */
+ runtimeDeath?: boolean
}): LinuxGpuDeathPath {
- if ((options.platform ?? process.platform) !== 'linux') {
+ if ((options.platform ?? process.platform) !== 'linux' || options.runtimeDeath) {
return null
}
diff --git a/apps/desktop/electron/linux-nvidia-egl-recovery.test.ts b/apps/desktop/electron/linux-nvidia-egl-recovery.test.ts
index c1ae6e5528d..4a1aca91cb5 100644
--- a/apps/desktop/electron/linux-nvidia-egl-recovery.test.ts
+++ b/apps/desktop/electron/linux-nvidia-egl-recovery.test.ts
@@ -6,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { launchBuildIdentity } from './launch-build-identity'
import { createLaunchMarkerWriter } from './launch-marker-writer'
+import { linuxGpuChildDeathPath } from './linux-gpu-fallback'
import { nvidiaEglMarkerPath, readNvidiaEglMarker, writeNvidiaEglMarker } from './linux-nvidia-egl-fallback'
import { createNvidiaEglRecovery, NVIDIA_GPU_DEATH_WITNESS_GRACE_MS } from './linux-nvidia-egl-recovery'
@@ -182,4 +183,18 @@ describe('NVIDIA GPU-death witness window', () => {
expect(first.gpuDied({ type: 'GPU', reason: 'killed', exitCode: 15 })).toBe(true)
expect(launch().decision.enable).toBe(true)
})
+
+ it('a crash long after a healthy boot takes neither the SwiftShader nor the --disable-gpu relaunch', () => {
+ let clock = 1_000
+ const first = launch({ now: () => clock })
+ first.healthy()
+ clock += NVIDIA_GPU_DEATH_WITNESS_GRACE_MS + 1
+ const details = { type: 'GPU', reason: 'crashed', exitCode: 139 } as const
+
+ // main.ts asks both ladders about the same death.
+ expect(linuxGpuChildDeathPath({ platform: 'linux', details, runtimeDeath: first.afterBootWindow() })).toBeNull()
+ expect(first.gpuDied(details)).toBe(false)
+ expect(first.relaunch).not.toHaveBeenCalled()
+ expect(readNvidiaEglMarker(userData)).toEqual({ state: 'ok' })
+ })
})
diff --git a/apps/desktop/electron/linux-nvidia-egl-recovery.ts b/apps/desktop/electron/linux-nvidia-egl-recovery.ts
index 5627ac9140f..946901a70b3 100644
--- a/apps/desktop/electron/linux-nvidia-egl-recovery.ts
+++ b/apps/desktop/electron/linux-nvidia-egl-recovery.ts
@@ -38,6 +38,7 @@ export function createNvidiaEglRecovery(options: NvidiaEglRecoveryOptions) {
let relaunchAttempted = false
let healthyAt: number | null = null
const now = options.now ?? Date.now
+ const afterBootWindow = (): boolean => healthyAt !== null && now() - healthyAt > NVIDIA_GPU_DEATH_WITNESS_GRACE_MS
const persist = (marker: NvidiaEglMarker): void => {
try {
@@ -57,6 +58,8 @@ export function createNvidiaEglRecovery(options: NvidiaEglRecoveryOptions) {
return {
decision,
startupMessage: `[gpu] NVIDIA ANGLE fallback=${decision.enable} (${decision.reason ?? 'not selected'}); previous=${previous?.state ?? 'none'}; build=${options.buildIdentity ?? options.appVersion}; driver=${options.driverVersion}`,
+ /** A GPU death now is a runtime event: no recovery ladder may relaunch or write a fallback for it. */
+ afterBootWindow,
healthy(): void {
if (!primary || quitting || relaunchAttempted) {
return
@@ -90,7 +93,7 @@ export function createNvidiaEglRecovery(options: NvidiaEglRecoveryOptions) {
!primary ||
quitting ||
teardownInProgress ||
- (healthyAt !== null && now() - healthyAt > NVIDIA_GPU_DEATH_WITNESS_GRACE_MS) ||
+ afterBootWindow() ||
!nvidiaEglFallbackAllowed(options) ||
!shouldRelaunchForNvidiaGpuDeath({
platform: options.platform,
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index ceee9eca3a9..94f89e88425 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -1085,7 +1085,8 @@ if (IS_WINDOWS || process.platform === 'linux') {
alreadyNoSandbox: windowsSandboxFallbackActive || alreadyHasNoSandbox(process.argv, process.env),
alreadySoftware,
sandboxRelaunchAttempted: windowsNoSandboxRelaunchAttempted,
- softwareRelaunchAttempted: linuxGpuRelaunchAttempted
+ softwareRelaunchAttempted: linuxGpuRelaunchAttempted,
+ runtimeDeath: nvidiaEglRecovery.afterBootWindow()
})
// One event must not schedule both ANGLE and disable-gpu relaunches.