mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
fix: avoid renderer launch-failed reload loop (#4599)
This commit is contained in:
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user