Skip to content

fix(desktop): re-apply SA_ONSTACK to survive WebKitGTK JSC signal handler clobbering#351

Merged
Adam-D-Lewis merged 2 commits into
mainfrom
fix/webkit-sa-onstack
May 26, 2026
Merged

fix(desktop): re-apply SA_ONSTACK to survive WebKitGTK JSC signal handler clobbering#351
Adam-D-Lewis merged 2 commits into
mainfrom
fix/webkit-sa-onstack

Conversation

@Adam-D-Lewis

@Adam-D-Lewis Adam-D-Lewis commented May 26, 2026

Copy link
Copy Markdown
Member

Fixes #350.

WebKitGTK's JavaScriptCore installs SIGSEGV/SIGBUS/SIGUSR1 handlers (for
GC thread suspension, write barriers, Wasm trap handling) without
SA_ONSTACK, which Go's runtime refuses to tolerate. Wails 2.12.0 added
a one-shot mitigation but JSC installs its handlers lazily on first JS
context creation — usually after that one-shot fix has already run.

This PR:

Verified on Ubuntu 26.04 LTS + libwebkit2gtk-4.1 v2.52.3.

Suggested follow-up: release after merge

The broken 0.10.5 and 0.11 linux-64 builds are being marked broken on
conda-forge via conda-forge/admin-requests#2104.
Once that lands, pixi global install nebi on linux-64 will resolve to
0.10.4 (the last known-good release). Once this fix PR is merged we
should cut a new release (suggest 0.11.1 or 0.12) so linux-64
users get a current nebi-desktop back rather than being pinned to
0.10.4 indefinitely.

Removal of the workaround

Once wailsapp/wails#5507
ships in a tagged Wails release and we bump to it, signal_fix_linux.go
can be deleted (the comment in that file documents this).

…untime

Wails 2.11.0 installed SA_ONSTACK on signal handlers before gtk_init, which
let WebKit's later signal install (without SA_ONSTACK) clobber it. Bump to
Wails 2.12.0, which defers the fix to g_idle_add after gtk_init, AND add a
linux-only background ticker that re-applies SA_ONSTACK on SIGSEGV/SIGBUS/etc.
JavaScriptCore installs its GC/Wasm trap handlers lazily on first JS context
creation — which can land after the one-shot idle pass — so a periodic
re-fix is needed to be reliable on Ubuntu 24.04+ / libwebkit2gtk-4.1.

Verified: nebi-desktop now boots, serves the embedded API for 30+ seconds
of clicking around, and exits cleanly on window close.
Reference upstream Wails fix wailsapp/wails#5507 (closes wails#5506) so a
future maintainer knows this Go-side ticker can be deleted once the Wails
release containing that PR lands and we've bumped to it. Also add SIGUSR1
(JSC GC thread sync) to the fix list, matching the additional signal that
the upstream PR fixes.
@netlify

netlify Bot commented May 26, 2026

Copy link
Copy Markdown

Deploy Preview for nebi-docs canceled.

Name Link
🔨 Latest commit 2038e74
🔍 Latest deploy log https://app.netlify.com/projects/nebi-docs/deploys/6a1606950b062c0008cbcc9f

@Adam-D-Lewis Adam-D-Lewis requested a review from aktech May 26, 2026 20:51

@viniciusdc viniciusdc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work, looked at the change good catch. I just ask to open a follow up issue after this gets merged so that we have a tracking issue open on our side as well to remove this once that PR lands.

@Adam-D-Lewis Adam-D-Lewis merged commit 0afe891 into main May 26, 2026
14 checks passed
@Adam-D-Lewis Adam-D-Lewis deleted the fix/webkit-sa-onstack branch May 26, 2026 21:10
aktech pushed a commit that referenced this pull request Jun 1, 2026
Build-only CI doesn't exercise runtime initialization, so issues like
the WebKitGTK/JSC signal-handler SIGSEGV from #350/#351 — which only
trips once the JS context lazy-inits — slip through.

Add a post-build step on each OS that launches the artifact, waits 10s,
and fails if it exited or crashed within that window:
- Linux: xvfb-run + timeout, expect exit 124 (timed out still-running)
- macOS: open Nebi.app, pgrep -x Nebi
- Windows: Start-Process -PassThru, check HasExited

Runs before release upload so a regression also gates v* tag releases.
Adds xvfb to the Linux apt deps.
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.

[BUG] - nebi-desktop crashes on Linux/WebKitGTK (SA_ONSTACK fatal) since v0.10.5

2 participants