magpie icon indicating copy to clipboard operation
magpie copied to clipboard

Linux/NVIDIA: clicking the sidebar button crashes the whole app (WebKitWebProcess SIGSEGV in libnvidia-eglcore on document.startViewTransition); fix with tests on a fork branch

Open fffllight opened this issue 1 month ago • 4 comments

Environment

  • magpie 0.1.1203 (Wails v3.0.0-beta.24, GTK 3 + WebKitGTK 4.1)
  • Ubuntu 24.04.5, kernel 6.8, X11 session (GDK_BACKEND=x11, no Wayland)
  • NVIDIA RTX 4080, driver 595.84 (nvidia-driver-595-open, Ubuntu's recommended one), no iGPU
  • libwebkit2gtk-4.1-0 2.52.6-0ubuntu0.24.04.1

Steps

  1. Start magpie, open the main window.
  2. Click the sidebar toggle in the title bar (or Ctrl+Shift+S).
  3. The window disappears: WebKitWebProcess gets SIGSEGV, then the main process dies with SIGSEGV ... signal arrived during cgo execution inside g_application_run. 100% reproducible, identical stack in four core dumps.

Stack (WebKitWebProcess, main thread, systemd-coredump)

#0-#7   libnvidia-eglcore.so.595.84 (+0xa3539f top frame)
#8-#11  libEGL_nvidia.so.0
#12-#19 libwebkit2gtk-4.1.so.0
#20-#22 libjavascriptcoregtk-4.1.so.0
#23-#27 glib main loop / WTF::RunLoop::run

Root cause

navMorph() in internal/gui/assets/app.js wraps the sidebar layout change in document.startViewTransition(). On this setup any view transition crashes WebKitGTK, independent of magpie: a 30-line PyGObject WebKit2 window that only calls startViewTransition(() => body.classList.toggle("x")) on a timer segfaults within a second (script at the end), and the host process goes down with it. Checked on the same page:

Case Result
bare startViewTransition, no view-transition-name crash
WEBKIT_DISABLE_COMPOSITING_MODE=1 crash
WEBKIT_DISABLE_DMABUF_RENDERER=1 (in magpie) crash
__EGL_VENDOR_LIBRARY_FILENAMES=…/50_mesa.json (Mesa's EGL instead of NVIDIA's) no crash
GTK gtk-enable-animations=false → prefers-reduced-motion: reduce → magpie's navCalm() path no crash
CSS backdrop-filter, filter: blur, element.animate, @keyframes, canvas no crash

So this is a WebKitGTK 2.52 + NVIDIA EGL bug in the view-transition snapshot path, but it takes the whole app down, the user can't avoid it short of turning off all desktop animations, and the sidebar toggle is the only startViewTransition in the UI. Similar reports in other WebKitGTK apps on NVIDIA 595.99/610.57: emiliano-go/postal#226, zackees/kernal-api#272.

Fix (ready on a fork; PRs from non-collaborators are limited, so here it is)

Branch fffllight:gui-linux-no-view-transition, one commit: https://github.com/fffllight/magpie/commit/7794bca4f7410c5bbc2b5809a7b66ca2627f78cc Compare: https://github.com/yetone/magpie/compare/main...fffllight:magpie:gui-linux-no-view-transition

  • app.js: navMorphs() beside navCalm(); Linux's window (body.linux, not magpie web) has the new layout at once, as under reduced motion. magpie web in a browser on Linux still trades places.
  • side-toggle.test.cjs: "the two trade places as one motion" pins navigator.platform to MacIntel (on a Linux host the page would otherwise be Linux's window). New case "Linux's window: at once": Linux platform, startViewTransition present and wrapped to record a call, two clicks, the layouts changed at once with no call and no nav-morph.
  • docs/subsystems/gui-shell.md: the Window navigation row says so.

Run (Playwright 1.49.1, Node 18, Ubuntu 24.04): side-toggle.test.cjs in Chromium and WebKit, 18 pass; with app.js put back to origin/main the new case fails in both engines (the header at once: expected false, actual true). sidebar, side-width, header-centre, header-relang, view-no-sideways, brand, panel-drag-linux: 100 pass in both engines. go vet -tags nogui ./internal/gui ok. Not built with the GUI tag on this box (no webkit2gtk-4.1-dev), so not clicked in the real Wails window; the crash itself was reproduced in magpie four times, and the mechanism and both workarounds with the page below.

Repro outside magpie (needs python3-gi, gir1.2-webkit2-4.1)
import sys, gi
gi.require_version('Gtk','3.0'); gi.require_version('WebKit2','4.1')
from gi.repository import Gtk, WebKit2, GLib
html = """<!doctype html><html><head><style>body{margin:0;background:#1b2130;color:#eee;font:15px sans-serif}
#a{padding:20px;transition:margin .3s}body.x #a{margin-left:200px}</style></head><body><div id="a">hello</div>
<script>setInterval(()=>document.startViewTransition(()=>document.body.classList.toggle("x")),600)</script></body></html>"""
w = Gtk.Window(title="vt"); w.set_default_size(800, 500)
v = WebKit2.WebView(); w.add(v)
v.connect("web-process-terminated", lambda view, r: (print("WEB PROCESS TERMINATED:", r), Gtk.main_quit(), sys.exit(2)))
w.connect("destroy", Gtk.main_quit)
v.load_html(html, "file:///"); w.show_all()
GLib.timeout_add(5000, lambda: (print("survived 5s"), Gtk.main_quit(), sys.exit(0)))
Gtk.main()

On NVIDIA's EGL the process itself segfaults (exit 139) before 5 s; with __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json it prints survived 5s.

fffllight avatar Oct 12 '26 06:10 fffllight

I can reliably reproduce a similar sidebar/top-navigation toggle crash on Omarchy (Arch Linux / Hyprland). This may be related to this issue, but the signal and native stack differ from the original NVIDIA EGL SIGSEGV report.

Environment

  • Magpie: 0.1.1206
  • WebKitGTK: webkit2gtk-4.1 2.54.1-1
  • Desktop: Omarchy / Hyprland
  • NVIDIA GPU present; exact GPU/driver versions were not collected for this report.

Reproduction

  1. Open the Magpie main window.
  2. Click the control switching between sidebar and top navigation.
  3. WebKitWebProcess aborts and the window becomes blank.

This action is consistently reproducible on this machine. Expected: the navigation layout changes without a renderer crash.

Crash evidence

Two systemd-coredump records on 2026-10-12, at 16:34:28 and 16:55:28 CST (UTC+8), both show SIGABRT in /usr/lib/webkit2gtk-4.1/WebKitWebProcess. The main-thread library offsets match across both crashes.

Selected frames (offsets relative to libwebkit2gtk-4.1.so.0):

#1 raise
#2 abort
#3 +0x142b369  unresolved
#4 +0x1cf052c  unresolved
#5 +0x1b84410  WTF::RefCountedBase::derefBase() const
#6 +0x402c285  WebCore::GraphicsLayer::create(...)
#7 +0x402ba65  WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange()
#8 +0x45cec3d  WTF::SingleThreadIntegralWrapper<unsigned int>::valueWithoutThreadCheck() const
#9 +0x31ad2d1  WebCore::jsDocumentPrototypeFunction_startViewTransition(...)

The offsets were resolved using eu-addr2line and Arch debuginfo matching the installed WebKit library build ID edba0f0fa640969c2b0152af5cd0639025df170e.

This confirms startViewTransition is on the crashing path, but the top abort callers and exact failed assertion remain unresolved. These partial symbols do not establish a reference-counting bug or prove the same root cause as the original report.

No workaround or proposed patch has been tested on this machine. Could you assess whether this WebKitGTK 2.54.1 SIGABRT variant belongs to the same issue and whether bypassing the native Linux view transition is appropriate here too?

moxuun avatar Oct 12 '26 09:10 moxuun

补充一个非 NVIDIA 的复现,并验证了 @fffllight 的修复(7794bca)。

环境

  • magpie 0.1.1206(v0.1.1206-1-g5e7efce),Wails v3.0.0-beta.24,GTK3 + WebKitGTK 4.1 2.52.6(Ubuntu 24.04)
  • Zorin(GNOME / Wayland),Intel Iris Xe(Raptor Lake-P)+ Mesa 25.2.8,无独显,未设任何 WebKit 环境变量

现象 点侧边栏按钮 / Ctrl+Shift+S,整个应用立刻退出(本地网关一起停)。3 分钟内崩了 5 次(17:27:05、17:27:35、17:28:22、17:28:54、17:29:00 CST)。

崩溃签名(5 次完全一致)

SIGSEGV: segmentation violation
PC=0x...e36a2  m=0 sigcode=1 addr=0x48
signal arrived during cgo execution
goroutine 1 ... [syscall, locked to thread]
  ... wails/v3 application._Cfunc_g_application_run
  • addr=0x48、故障指令页内偏移每次都相同:native 代码同一处空指针解引用,不是 Go panic;挂掉的是 UI/宿主进程本身(转储来自 magpie 自己,栈停在 GTK 主循环)。
  • 0x48 是 AcceleratedBackingStore::m_surfaceID 的偏移,对应 WebKit bug 321683 / 323949:EnterAcceleratedCompositingMode 里拦住 null backing store 的检查是 ASSERT(),release 构建会编译掉。所以这不是 NVIDIA EGL 专属——Intel + Mesa 同样命中;@moxuun 在 2.54.1 上的 SIGABRT 很可能也属同一类(由 view transition 触发)。

对修复的验证(fffllight:gui-linux-no-view-transition,7794bca)

  • 逻辑正确:magpie 里唯一的 document.startViewTransition 就是 navMorph;body.linux 由 layout.js 在首帧按 !web && /^Linux/ 设置,web 区分 magpie web。因此补丁只在 Linux 原生窗口跳过转场,macOS / Windows 与浏览器模式不受影响(我这边是 Wayland,补丁按平台判断,同样覆盖)。
  • 红绿测试(Playwright 1.61 + Chrome 154 的 chromium 引擎;本机未安装 Playwright 自带 Chromium,故换成 chrome 通道)跑 internal/gui/tests/side-toggle.test.cjs:
    • 修复版:9/9 通过(含新增的 “Linux's window: at once”);
    • 只把 app.js 回退到修复前:新用例失败(morphed 期望 false、实际 true),确实锁住了这个回归。
  • 套到当前 main(5e7efce)cherry-pick 干净无冲突;side-toggle 9/9,邻接套件 sidebar 8/8、side-width 5/5、header-centre 7/7、header-relang 6/6、brand 1/1 全绿。

建议合并该修复(或等价的“Linux 原生窗口跳过 view transition”方案),等 WebKit 侧修好 321683 后再恢复动画。

louisgreen0726 avatar Oct 12 '26 09:10 louisgreen0726

@fffllight @moxuun @louisgreen0726 Sorry for the slow reply here, and thank you for the core dumps, the out-of-magpie repro and the red/green runs.

Main already has this fix: f5dd4d604, released in v0.1.1209. It does the same thing as fffllight's 7794bca: in navMorph() (internal/gui/assets/app.js), the Linux app (body.linux) switches the layout at once, the same path reduced motion takes. magpie web in a Linux browser keeps the motion. It also adds a guard for other webviews: a transition still running after 1.5s is cut short. It was reproduced and checked on Hyprland/Wayland with WebKitGTK 2.52.6, where the click crashed 4 of 4 times before and didn't crash after. That was the only document.startViewTransition in the GUI, so the fix is platform-wide on Linux. It covers the NVIDIA EGL SIGSEGV, the Intel/Mesa null backing store and @moxuun's 2.54.1 SIGABRT, since all three crash inside startViewTransition.

f5dd4d604 was written separately, from a report on X. @fffllight, your branch reached the same fix first, with the same test idea, so the credit is on record here.

Could you each update to v0.1.1209 or later and confirm that the sidebar button and Ctrl+Shift+S no longer crash? The issue stays open until then.

(@louisgreen0726:修复是 f5dd4d604,已在 v0.1.1209 发布,思路与 7794bca 相同。麻烦升级后确认一下 Intel/Mesa 下是否不再崩溃。)

yetone avatar Oct 12 '26 20:10 yetone

@yetone 已升级到 v0.1.1220 确认:Ubuntu 24.04 / X11 / RTX 4080 / 驱动 595.84 / WebKitGTK 2.52.6 下,点侧边栏按钮和 Ctrl+Shift+S 都不再崩溃,布局直接切换,多次开关没有问题。问题已解决,我这边关掉这个 issue;@moxuun @louisgreen0726 如果你们的环境还有问题可以再开。谢谢!

fffllight avatar Oct 13 '26 06:10 fffllight