fix(desktop): skip community view transition on Linux WebKitGTK to avoid UI-process segfault - #5768
fix(desktop): skip community view transition on Linux WebKitGTK to avoid UI-process segfault#5768oso0x34 wants to merge 2 commits into
Conversation
|
two things about the platform half is already available without sniffing: more importantly the heuristic fails open. this guards a UI-process segfault, so the cost of not matching is a crash, and |
Chessing234
left a comment
There was a problem hiding this comment.
the linux half of this already exists — shared/lib/platform.ts exports isLinuxPlatform(), used in AppearanceSettingsControls.tsx:173 and notifications/lib/desktop.ts. it's also the more careful test: it keys off navigator.platform and excludes android explicitly, where userAgent.includes("Linux") would match an android webview string if one ever turned up without a Chrome token. isLinuxPlatform() && !/Chrome/.test(navigator.userAgent) reuses the vetted half rather than adding a second definition of "linux" in a feature file.
fwiw i checked the thing that would have sunk the UA approach outright — tauri.conf.json sets no custom user agent, so the webview does report the stock WebKitGTK string. nice repro table.
|
Thanks — you're right on both counts, and I took the stronger of the two options you offered.
export function shouldSkipCommunityViewTransition(): boolean {
return isLinuxPlatform();
}I kept your framing in the comment above it, because the reasoning is the part worth preserving for whoever reads this next: it guards a UI-process segfault, so it has to fail closed, and the cost of over-matching is a missing cross-fade rather than a crash. Deliberate consequence, worth stating plainly: Chromium on Linux now skips the transition too — that includes dev-server sessions and Playwright runs on Linux CI. I traced the call sites first; One gotcha the tests turned up, in case it bites someone else: Node 22 sets Verification at
I also had an independent model review the change cold, with no steer toward what I expected it to find; it approved and flagged only the Linux-Chromium E2E coverage tradeoff noted above, which is why I am surfacing it here rather than leaving it implicit. Also worth linking from here: per @HolgerHatGarKeineNode's analysis in #3488, the crash is now fixed for the population that hit it through Buzz's own |
…oid UI-process segfault WebKitGTK 2.52 dereferences a null AcceleratedBackingStore when a view transition is the first thing to demand accelerated compositing and the backing store could not be created (X11 sessions, dmabuf transport disabled or unavailable). The guard is a debug ASSERT that release builds compile out, so every community switch segfaults the UI process on affected machines — 100% reproducible, including with the WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 heuristic applied. Detect Linux WebKitGTK by user agent and take the existing no-startViewTransition fallback path: the community switch still runs, just without the cross-fade, until a fixed WebKitGTK ships. Fixes block#3488 Fixes block#4142 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: oso0x <getdtms@gmail.com>
…user agent Review feedback: the previous heuristic failed open. It sniffed the user agent and required the absence of a "Chrome" token, so a webview whose UA ever gained a Chrome-ish token would silently disable the workaround and bring back a UI-process segfault, with nothing pointing at the call site. Use the existing isLinuxPlatform() helper instead, which reads the real platform rather than the UA string. On Tauri, Linux means WebKitGTK, so this fails closed: the worst case is a missing cross-fade in a Linux browser session rather than a crash on a real one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: oso0x <getdtms@gmail.com>
7912051 to
bbc4ad5
Compare
|
Independent verification on a different environment — the fix works. Repro (pre-fix): Buzz 0.5.19 AppImage, Debian 13, X11, NVIDIA RTX PRO 6000 (GB202). Launcher sets Post-fix: built main + this PR (7912051 onto 1c8321c) as an AppImage via Two extra data points for the thread:
Happy to run additional matrix (Wayland session, different compositing flags) on this box if useful. |
Summary
Switching communities crashes the Buzz UI process on many Linux machines,
100% of the time (#3488, #4142). The root cause is a WebKitGTK 2.52 bug:
when a view transition is the first thing to demand accelerated
compositing and the accelerated backing store could not be created, the
UI process dereferences a null
AcceleratedBackingStore. The guard forthat case is a debug
ASSERT, which release builds compile out — sousers get a bare
SIGSEGVinstead of an assertion.This PR detects Linux WebKitGTK by user agent in
runCommunityViewTransitionand takes the existingno-
startViewTransitionfallback path. The community switch stillhappens — instantly, without the cross-fade — until a fixed WebKitGTK
ships. Two tests added, no other behavior touched.
Why the FORCE_SHM heuristic doesn't cover this
webkit_rendering.rs(the #3654 fix) setsWEBKIT_DMABUF_RENDERER_FORCE_SHM=1on NVIDIA/AppImage. That does notprevent this crash. We wrote a ~100-line repro outside Buzz — plain
GTK +
WebKitWebViewwhose page just callsdocument.startViewTransition()in a loop — and ran it with a scrubbed environment (
env -i), onevariable at a time, on Ubuntu 24.04 / GNOME-X11 / NVIDIA / WebKitGTK
2.52.3:
segfault at 48, offsetfd69b2WEBKIT_DMABUF_RENDERER_FORCE_SHM=1(what Buzz ships)WEBKIT_DISABLE_DMABUF_RENDERER=1(legacy)ViewTransitionsWebKit feature disabledsegfault at 48ism_surfaceIDat offset0x48read through a nullthis, matching the symbolized analysis by @shawnyeager in #3488 exactly.The null store is the default state on this X11 box — no env var
needed to get there — so no rendering env tweak can fix it. The only
app-side mitigation is not entering the view-transition compositing path.
Why a UA check instead of
isLinuxPlatform()#4276 proposes the same guard via
shared/lib/platform.ts'sisLinuxPlatform(), which readsnavigator.platform. Node ≥ 21 definesnavigator.platform === "Linux x86_64"under plain Node on Linux, sothat guard also fires inside the unit-test runner: the three existing
communityViewTransitiontransition-path tests then take the fallbackbranch and fail on any Linux dev box or CI runner (they pass on macOS,
which hides it locally).
The UA check here (
Linux+AppleWebKit−Chrome) targets WebKitGTKspecifically — Node's UA (
Node.js/24) and Chromium dev-server sessionson Linux keep the real transition path, and the suite stays green.
Related issue
Fixes #3488. Fixes #4142.
Searched for duplicates — the closest existing PR is #4276 (same call
site, motivated by the #3931
updateCallbackDonehang on communityremoval). It bundles unrelated agent-UI changes and trips the unit-test
issue above. Maintainers should feel free to take whichever they prefer;
the goal is just to stop the Linux crashes. This guard very likely also
resolves #3931, since it skips the same API on the same platform — but we
only verified the segfault, not the hang, so it isn't claimed here.
Also related: #3654 (the env-var mechanism this bypasses).
Testing
pnpm test(desktop): 4763 pass / 0 fail, including 2 new tests —a UA detection matrix, and "Linux WebKitGTK runs the update without
calling
startViewTransition".pnpm typecheckclean;pnpm checkclean.switch. Running the same build with the
ViewTransitionsWebKitfeature disabled — which routes through the identical fallback branch
this PR selects — community switching has been 100% stable since.
skipped and runs clean with it skipped; source and full matrix
available if useful for CI or for the upstream report.
No screenshots: the visible change on Linux is the absence of the
cross-fade (an instant switch), and the "before" state is the app
disappearing. Happy to attach a screen recording of both if a maintainer
wants it.
Upstream
Filed against WebKitGTK with the minimal repro attached and a proposed
ASSERT→ runtime-null-check patch for the three unguarded call sites inWebKitWebViewBase.cpp:https://bugs.webkit.org/show_bug.cgi?id=321683
Revert condition
Once Buzz's minimum WebKitGTK carries that upstream fix, this guard can be
removed.