Repository navigation
[Bug]: Desktop app can still crash when a preview tab's renderer dies mid-screenshot, until Electron ships Chromium 157 #24094
Description
[Opus 5.5][Claude Code] on behalf of shivam.
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
What happened
#24026 reported the desktop app crashing (SIGSEGV at 0x0 in the main process) when a preview tab's renderer died while an agent was taking a snapshot of it. The cause is a Chromium bug, not T3 code:
- An agent snapshot ends in a CDP
Page.captureScreenshoton the guest. Chromium copies the tab's surface for it. - If the guest's renderer dies while that copy is in flight, the copy fails.
RenderWidgetHostImpl::OnSnapshotFromSurfaceReceivedretries throughGetView()->CopyFromSurfacewithout checkingGetView(), which is null once the renderer is gone.PageHandler::ScreenshotCapturedhas the same uncheckedGetView()when a clip is set, and our snapshots send a clip when they downscale. - Chromium fixed both in 157: crbug.com/567321049, commit
f49f3e5. We ship Electron 44.9.3, and the newest stable Electron (45.0.0) is on Chromium 156, so every build today can hit it.
I reproduced it on Linux with Electron 44.9.3. A harness loaded the real DesktopBrowserHost.ts into Electron, kept agent screenshots in flight, and SIGKILLed the guest renderer. The crash symbolicated to the same frame as #24026.
What #24056 changed, and why it isn't the whole fix
T3 made the crash much likelier than it needed to be. A guest could have several screenshots copying at once, because snapshots overlapped and because a snapshot the server timed out on keeps running inside Chromium (CDP commands can't be cancelled). Every copy in flight is another chance to be mid-copy when the renderer dies.
#24056 sends each guest one screenshot at a time. The queue moves on when the page navigates or reloads, since a pending capture can go unanswered across a new document, and screenshots left by a released relay are dropped. In the stress harness, crashes per renderer kill went from 9 of 32 (about 28%) on main to 20 of 774 (about 2.6%), and the rate rises with machine load.
One copy can still be in flight when a renderer dies, so the crash is rarer but still possible. That's what this issue tracks.
Expected behavior
A preview tab whose renderer dies during a snapshot reports a crashed tab, and the app keeps running.
Actual behavior
Since #24056 this is rarer, but the desktop main process can still segfault, taking the bundled server with it.
What would fully fix it
Either one:
- Bump
apps/desktopto an Electron release on Chromium 157 or newer once one is stable. - Ask Electron to backport
f49f3e5to the 44-x-y and 45-x-y branches, then take that patch release.
Once Electron has the fix, the one-at-a-time queue in DesktopBrowserHost.ts can stay, since it keeps abandoned captures from piling up, or it can go.
Impact
Minor bug or occasional failure
Version or commit
main at cccb78c, after #24056 (Electron 44.9.3)
Environment
Desktop app. Reproduced on Linux (Xvfb, Electron 44.9.3); originally reported on macOS arm64 (Electron 44.4.5).
Workaround
None in the app. Agents taking fewer snapshots of a page that is about to run out of memory makes it less likely.
Activity
SKCarlsson commentedon Oct 24, 2026
Hit again on macOS with #24056 included. The evidence suggests the capture that crashed the app had been stuck for about a day, so the risk lasts longer than "while a screenshot is in flight".
The crash
0.1.3-nightly.20261023.3579(Electron 44.9.3), macOS 27.0.1 arm64. The bundle contains fix(desktop): reduce app crashes when a preview tab's renderer dies during agent screenshots #24056's one-screenshot-per-guest queue.4C4C442D55553144A1FC8F505C7CA8700, which matches the crash report). It's the same frame as [Bug]: Desktop main process segfaults when a preview tab's renderer dies during an agent snapshot screenshot #24026:The faulting instruction is
ldr x8, [x21]withx21 = 0(the nullGetView()), followed by a vtable call.No screenshot was being taken
The retained server traces cover the ~50 minutes before the crash and contain no preview automation calls. The only preview spans are
PreviewAutomationBroker.focusHostandPreviewManager.closeat 21:05:51.65, after the main process had already died.The pending capture was probably ~26 hours old
macOS
powerdshows the main process holding a"Capturing"NoDisplaySleepAssertion for the whole session:In Chromium 152 the only DevTools path that takes this lock is
Page.captureScreenshot:IncrementCapturerCount(stay_awake=true)atpage_handler.cc:1432. The handle lives inPendingScreenshotRequestuntil the snapshot callback runs.Page.startScreencasttakes no capturer handle, and neither doesDevToolsVideoConsumer. Outside DevTools, a tab-capture stream (thegetDisplayMediarecording path) holds the same lock. A lock held for 25.6 hours plus a crash in the screenshot callback with no screenshot requested points to onePage.captureScreenshotthat stalled on 2026-10-23 and stayed pending until the guest's renderer went away. The desktop and server traces from 19:29 on 2026-10-23 have already rotated out, so I couldn't see which call started it.What this means for this issue
webContents.isBeingCaptured()is still true is carrying a stuck capture (untested).kCDPScreenshotNewSurfacecheck: "When view is completely hidden, capturing a surface snapshot will stall because the surface is never presented." Not sendingPage.captureScreenshotto a hidden guest, and usingcapturePage()instead, would avoid creating stuck captures until Electron ships Chromium 157.I couldn't see what ended the guest renderer at 21:05:51 because macOS doesn't log renderer exits. A T3 utility helper exited and T3's audio session stopped about 100 ms before the main process died.