Patch source: https://github.com/felixonmars/archriscv-packages/commit/c892e1fff21f427b5753b5d9cd8defb6b14763dd Disable v8's trap handler[1] to workaround ENOMEM on sv39 systems[2]. v8's OOB trap handler for wasm tries to allocate a 10 GB guard region[3], but unfortunately on sv39 systems we only have 256GB virtual memory for userspace, which is usually already exhausted by the node process and leads to `WebAssembly.Instance(): Out of memory: Cannot allocate Wasm memory for new instance` errors [1]: https://chromium-review.googlesource.com/c/v8/v8/+/5227604 [2]: https://github.com/riscv-forks/electron/issues/3#issuecomment-2391689815 [3]: https://github.com/nodejs/node/blob/09a8440b45f69651ff52110cb1bc2dde9e14e2e8/deps/v8/src/objects/backing-store.cc#L38 --- a/deps/v8/src/trap-handler/trap-handler.h +++ b/deps/v8/src/trap-handler/trap-handler.h @@ -46,7 +46,7 @@ #define V8_TRAP_HANDLER_SUPPORTED true // RISCV64 (non-simulator) on Linux. #elif V8_TARGET_ARCH_RISCV64 && V8_HOST_ARCH_RISCV64 && V8_OS_LINUX -#define V8_TRAP_HANDLER_SUPPORTED true +#define V8_TRAP_HANDLER_SUPPORTED false // RISCV64 simulator on x64 on Linux #elif V8_TARGET_ARCH_RISCV64 && V8_HOST_ARCH_X64 && V8_OS_LINUX #define V8_TRAP_HANDLER_VIA_SIMULATOR