Skip to content

Log Electron renderer and child process failures - #18808

Merged
kevinushey merged 2 commits into
mainfrom
codex/electron-process-failure-logging
Sep 14, 2026
Merged

kevinushey merged 2 commits into
mainfrom
codex/electron-process-failure-logging

Conversation

@kevinushey

@kevinushey kevinushey commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

Intent

Renderer failures currently appear only in debug logging, where their details are replaced with <object>, and GPU/utility process exits are not logged. Record these failures at error level so normal desktop logs can help diagnose crashes such as #18803.

Approach

Register application-wide render-process-gone and child-process-gone handlers before windows are created. Preserve Electron's reason and exit code, the affected renderer's web-contents ID, and child-process type and optional service names. Keep clean exits at debug level and remove the redundant generic renderer-exit handler.

Automated Tests

Validated on Windows x64 with Electron 43.7.0:

  • Five new unit tests cover renderer and GPU crashes, signed exit codes, utility service metadata, launch failures with exit code zero, and clean-exit log levels.
  • Full desktop unit suite: npm test -- --timeout 10000 — 466 passing, 13 pending. The isolated worktree uses the existing C++ build for component-path lookup; the longer timeout accommodates Windows network-path tests.
  • npm run typecheck and ESLint on all changed TypeScript files passed.
  • electron-forge package --platform win32 --arch x64 passed.

macOS and Linux were not tested locally.

QA Notes

On an affected Windows machine, reproduce the failure and inspect rdesktop.log at the default log level. Renderer failures should include reason, exitCode, and webContentsId; GPU/utility failures should include type, reason, exitCode, and any available name or serviceName. Clean exits should appear only with debug logging enabled.

The move/resize crash in #18803 has not been reproduced locally. These events can be recorded while Electron's main process remains alive; a native main-process crash may still require a crash dump.

Documentation

Added a NEWS entry describing the additional desktop failure diagnostics.

@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

1 test(s) failed

###################- 99% pass rate

Passed Failed Skipped Flaky
2162 1 136 9
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 4 0
❌ desktop-linux 733 1 38 3
✅ desktop-macos 731 0 42 3
✅ server-linux 680 0 44 3
✅ setup 16 0 8 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit f5b0580d5ea50b077e351c53e2bc2ab0841821fb - Run #998

@gtritchie gtritchie added this to the 2026.10 (Blue Mistflower) milestone Sep 13, 2026

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues. 0 blocking, 0 follow-up, 1 nit.

🟡 is optional — author's call.

  • 🟡 src/node/desktop/src/main/process-diagnostics.ts:21 — only clean-exit is demoted to debug, so a process killed during normal teardown logs as an error

The rest of the diff checked out: registerProcessDiagnostics() runs once from beforeAppReady() before any window exists (matching its doc comment), webContentsId is dropped from the JSON for child-process-gone because JSON.stringify omits undefined, launch-failed with exitCode: 0 still logs as an error because the branch keys on reason, and removing render-process-gone from registerWebContentsDebugHandlers loses nothing since that handler stringified the details object as <object>. The What's New window's own render-process-gone listener still fires independently.


function logProcessExit(eventName: string, details: Details | RenderProcessGoneDetails, webContentsId?: number): void {
const message = `Electron ${eventName}: ${JSON.stringify({ ...details, webContentsId })}`;
if (details.reason === 'clean-exit') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Only clean-exit is demoted to debug, so a renderer or utility process that Chromium reports as killed during a normal window close or app quit will be logged as an error.

Consider treating killed as debug too, or checking exitCode === 0.

Why

Electron lists killed alongside crashed/oom in the reason enum, and it can show up when a window is destroyed rather than shutting itself down. RStudio opens and closes satellite windows routinely, so this could put ERROR lines in the desktop log for ordinary teardown — noise in exactly the log this change exists to make readable. I haven't confirmed which reason Electron reports on window destroy, so this may not come up at all.

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback posted, one minor thing to check out.

This branch was previously deployed

1 inactive deployment
e2e-playwright — f5b0580d Deployed Sep 14, 2026 by kevinushey via linux-desktop / E2E (ubuntu-24-x86_64) #998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants