Repository navigation
Log Electron renderer and child process failures - #18808
Conversation
RStudio E2E - all platforms1 test(s) failed
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
gtritchie
left a comment
There was a problem hiding this comment.
No blocking issues. 0 blocking, 0 follow-up, 1 nit.
🟡 is optional — author's call.
- 🟡
src/node/desktop/src/main/process-diagnostics.ts:21— onlyclean-exitis 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') { |
There was a problem hiding this comment.
🟡 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
left a comment
There was a problem hiding this comment.
Feedback posted, one minor thing to check out.
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-goneandchild-process-gonehandlers 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:
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 typecheckand ESLint on all changed TypeScript files passed.electron-forge package --platform win32 --arch x64passed.macOS and Linux were not tested locally.
QA Notes
On an affected Windows machine, reproduce the failure and inspect
rdesktop.logat the default log level. Renderer failures should includereason,exitCode, andwebContentsId; GPU/utility failures should includetype,reason,exitCode, and any availablenameorserviceName. 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.