You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(linux): re-apply signal handlers periodically to survive JSC lazy init (#5507)
* fix(linux): re-apply signal handlers periodically to survive JSC lazy init
WebKit's JavaScriptCore (JSC) lazily installs signal handlers (SIGSEGV for
JIT crash recovery, SIGUSR1 for GC thread sync) when JavaScript first
executes - not at WebView creation. These handlers are registered without
SA_ONSTACK, overwriting Go's handler which requires it.
The existing one-shot fix runs before any JS executes, so JSC wipes it out
immediately when it initialises. A 50ms periodic timer (100 iterations =
5s) running on the GTK main thread re-applies install_signal_handlers()
throughout the JSC initialisation window, ensuring Go's SA_ONSTACK
requirement is always satisfied.
Fixes#5506
* fix(linux): add SIGUSR1, WEBKIT_LOAD_FINISHED hook, and anchor GTK4 timer
Addresses code review feedback on #5507:
- Add SIGUSR1 to install_signal_handlers(): JSC uses SIGUSR1 for GC
thread synchronisation and installs it without SA_ONSTACK (visible as
"Overriding existing handler for signal 10" in stderr). The fix_signal
helper only adds SA_ONSTACK to whatever handler is already registered,
so this is safe for both Go's and JSC's handler.
- Hook WEBKIT_LOAD_FINISHED (v3 GTK4/GTK3) and DomReady (v2): by
page-load completion JSC is guaranteed to have initialised and
installed all its signal handlers. A targeted call to
install_signal_handlers() here provides a deterministic, event-driven
fix that complements the periodic timer.
- Anchor the GTK4 periodic timer to first WebView creation (sync.Once
inside windowNewWebview) rather than appNew(), mirroring the GTK3
pattern. This ensures the 5s coverage window starts when JSC can
actually initialise, not before any WebView exists.
* fix(linux): immediate install_signal_handlers in GTK4 fixSignalHandlers.Do
0 commit comments