Repository navigation
fix(crash-reporting): stop reporting whole-process-tree kills as renderer crashes #12484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import type { ProcessGoneSource } from './process-gone-classification' | ||
|
|
||
| // Why: an OS/user kill of the whole Electron tree (taskkill /T, session logout, | ||
| // a supervisor SIGKILL) reaches the Chromium children and the renderer as | ||
| // independent process-gone events; correlating them is the only way to tell that | ||
| // teardown apart from a renderer that died on its own. | ||
| export const PROCESS_TREE_KILL_WINDOW_MS = 2_000 | ||
|
|
||
| // Field offsets between the first and last event of one tree kill run -0.08s to | ||
| // +0.10s, so the renderer can arrive before its children; wait this long before | ||
| // deciding a renderer kill was solitary. | ||
| export const PROCESS_TREE_KILL_SETTLE_MS = 250 | ||
|
|
||
| // Why: one tree kill produces a handful of events; a deeper ring would only let a | ||
| // pre-existing child crash loop outlive the correlation window. | ||
| const MAX_TRACKED_KILLS = 16 | ||
|
|
||
| type TrackedKill = { | ||
| at: number | ||
| source: ProcessGoneSource | ||
| exitCode: number | null | ||
| reason: string | ||
| } | ||
|
|
||
| let trackedKills: TrackedKill[] = [] | ||
|
|
||
| export function observeProcessGoneKill(kill: TrackedKill): void { | ||
| trackedKills.push(kill) | ||
| if (trackedKills.length > MAX_TRACKED_KILLS) { | ||
| trackedKills = trackedKills.slice(-MAX_TRACKED_KILLS) | ||
| } | ||
| } | ||
|
|
||
| /** How many Chromium child processes died the same way inside the window — the | ||
| * signature of the whole tree going down rather than one process failing. */ | ||
| export function countSiblingProcessTreeKills({ | ||
| reason, | ||
| exitCode, | ||
| at = Date.now() | ||
| }: { | ||
| reason: string | ||
| exitCode: number | null | ||
| at?: number | ||
| }): number { | ||
| return trackedKills.filter( | ||
| (kill) => | ||
| kill.source === 'child' && | ||
| kill.reason === reason && | ||
| kill.exitCode === exitCode && | ||
| Math.abs(at - kill.at) <= PROCESS_TREE_KILL_WINDOW_MS | ||
| ).length | ||
| } | ||
|
|
||
| export function resetProcessTreeKillWindowForTest(): void { | ||
| trackedKills = [] | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep only child kills in the bounded ring.
recordProcessGoneCrashsends every killed source here, butcountSiblingProcessTreeKillsreads only child entries. Renderer entries can evict matching child kills from the 16-entry ring. A later renderer event can then be reported instead of suppressed.Ignore non-child observations. Add a regression test with matching child kills followed by 16 renderer kills.
Proposed fix
export function observeProcessGoneKill(kill: TrackedKill): void { + if (kill.source !== 'child') { + return + } trackedKills.push(kill) if (trackedKills.length > MAX_TRACKED_KILLS) { trackedKills = trackedKills.slice(-MAX_TRACKED_KILLS) } }📝 Committable suggestion