Linux x64 WASM `wasm_trampoline_wasm_ipint_call_wide32` crash in JSC, potentially stack overflow in WebAssembly while using PGlite
How can we reproduce the crash?
Seems flakey. Using pg-lite in tests. Will update when i have more info
Relevant log output
https://github.com/sroussey/ellmers/actions/runs/13607530195/job/38040777616
Stack Trace (bun.report)
Bun v1.2.4 (fd9a5ea) on linux x86_64_baseline [TestCommand]
Segmentation fault at address 0x7F7146505845
-
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32 -
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32 -
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32 -
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32 -
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32 -
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32 -
ld-temp.o:0:wasm_trampoline_wasm_ipint_call_wide32
Features: tsconfig, jsc
I can't repro locally (uname: Darwin 24.3.0 arm64 arm) with a debug build of bun. This may be linux-only.
@190n is able to reproduce on Linux x64. We see it in our own CI as well. It's most likely an issue with JavaScriptCore's new WASM In-place interpreter, but it's hard for us to take action on our end and fix it. We've let them know about the issue, but we haven't yet come up with a minimal reproduction that can be reproduced in ARM64, only on x64. It's possible/likely this is an x64-specific bug.
I reported a different, but similar-looking, crash to WebKit at https://bugs.webkit.org/show_bug.cgi?id=289009. I'm hoping that maybe the fix for that will also benefit pglite.
@sroussey, normally I would suggest you turn off IPInt (therefore reverting to the older Wasm interpreter) with the environment variable BUN_JSC_useWasmIPInt=0, but in my testing the old interpreter also has some issues with pglite. The working configurations I've found for running pglite seem to be:
- use an aarch64 CPU instead of x86_64
- use
BUN_JSC_jitPolicyScale=0. This will force the engine to JIT-compile code ASAP and use the interpreter much less. But it also harms performance, especially startup time, so I'm not sure if that will be a good solution for you.
Thanks for reporting, and I'm sorry that there isn't a straightforward resolution for this right now.
Are there any workarounds for this at the moment? I'm wanting to bundle the Gemini CLI, though this is a blocker. The above environment variable workarounds don't seem to be doing anything.