fix: avoid renderer launch-failed reload loop (#4599)

This commit is contained in:
Neil
2026-06-03 20:37:15 -04:00
committed by GitHub
parent 0a1f34f8f1
commit eb89a72fa0
2 changed files with 39 additions and 0 deletions
@@ -250,6 +250,18 @@ describe('shouldRecordProcessGoneCrash', () => {
).toBe(true)
})
it('still records renderer launch failures for diagnostics', () => {
expect(
shouldRecordProcessGoneCrash({
source: 'renderer',
processType: 'renderer',
reason: 'launch-failed',
exitCode: 18,
expectedTeardown: 'none'
})
).toBe(true)
})
it('records non-SIGTERM killed process exits outside expected lifecycle teardown', () => {
expect(
shouldRecordProcessGoneCrash({
@@ -303,4 +315,25 @@ describe('shouldRecoverRendererAfterProcessGone', () => {
})
).toBe(false)
})
it('does not recover renderer startup and security launch failures', () => {
expect(
shouldRecoverRendererAfterProcessGone({
reason: 'launch-failed',
expectedTeardown: 'none'
})
).toBe(false)
expect(
shouldRecoverRendererAfterProcessGone({
reason: 'launch-failed',
expectedTeardown: 'renderer-reload'
})
).toBe(false)
expect(
shouldRecoverRendererAfterProcessGone({
reason: 'integrity-failure',
expectedTeardown: 'none'
})
).toBe(false)
})
})
@@ -8,6 +8,7 @@ const RECOVERABLE_UTILITY_SERVICE_NAMES = new Set([
'network.mojom.NetworkService'
])
const RECOVERABLE_CHILD_PROCESS_REASONS = new Set(['abnormal-exit', 'crashed', 'killed'])
const NON_RECOVERABLE_RENDERER_REASONS = new Set(['integrity-failure', 'launch-failed'])
function isWindowsControlTerminationExitCode(exitCode: number | null): boolean {
if (exitCode === null) {
@@ -91,5 +92,10 @@ export function shouldRecoverRendererAfterProcessGone({
if (expectedTeardown === 'app-shutdown') {
return false
}
// Why: these mean Chromium could not start or trust the renderer process;
// retrying the same BrowserWindow load can loop indefinitely on Windows.
if (NON_RECOVERABLE_RENDERER_REASONS.has(reason)) {
return false
}
return !(reason === 'killed' && expectedTeardown === 'renderer-reload')
}