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
{{ message }}
Repository navigation
run wasm out of memory in mac causes node crash due to SIGBUS #46559
How often does it reproduce? Is there a required condition?
100% reproduce
What is the expected behavior?
behavior should be like in other arch.
wasm://wasm/5c312dfe:1
RuntimeError: memory access out of bounds
at assembly/index/_start (wasm://wasm/5c312dfe:wasm-function[0]:0x63)
at /Users/q540239/oss/as/tests/index.cjs:9:17
Ha, I remember asking if we didn't also have to catch SIGBUS to intercept WASM OOB accesses but back then that code was only enabled for Linux, which uses SIGSEGV instead of SIGBUS. Does this patch fix it?
Actually in macos we need to catch two exception, SIGBUS and SIGSEGV
Bus Error occur when a process is trying to access memory that the CPU cannot physically address.In other words the memory tried to access by the program is not a valid memory address.It caused due to alignment issues with the CPU.
Segmentation Fault occur when the program tries to write/read outside the memory allocated for it or when writing memory which can only be read.In other words when the program tries to access the memory to which it doesn’t have access to.
Too bad the logs aren't visible anymore but I do see a note at the bottom of https://github.com/nodejs/node/pull/46561/files pointing to test-cluster-primary-error.js - which is not the test you added.
Activity
bnoordhuis commentedon Feb 8, 2023
Ha, I remember asking if we didn't also have to catch SIGBUS to intercept WASM OOB accesses but back then that code was only enabled for Linux, which uses SIGSEGV instead of SIGBUS. Does this patch fix it?
HerrCai0907 commentedon Feb 8, 2023
Actually in macos we need to catch two exception, SIGBUS and SIGSEGV
Bus Error occur when a process is trying to access memory that the CPU cannot physically address.In other words the memory tried to access by the program is not a valid memory address.It caused due to alignment issues with the CPU.
Segmentation Fault occur when the program tries to write/read outside the memory allocated for it or when writing memory which can only be read.In other words when the program tries to access the memory to which it doesn’t have access to.
from https://www.geeksforgeeks.org/segmentation-fault-sigsegv-vs-bus-error-sigbus/
bnoordhuis commentedon Feb 8, 2023
Right, that's good general advice but in this specific case, due to how V8 wires up the trap handler, only SIGBUS is relevant.
unilynx commentedon May 31, 2023
We're seeing the same issue on mac and HerrCai0907's fix works for us. Is there anything we can do to help get this merged in node?
HerrCai0907 commentedon May 31, 2023
@unilynx The PR is blocked by ASan and I have no idea about node test environment and don't know how to test and fix this issue.
unilynx commentedon Jun 1, 2023
I've found https://github.com/nodejs/node/blob/main/.github/workflows/test-asan.yml but that one says
runs-on: ubuntu-20.04. Your patch shouldn't have any effect on Linux so maybe that asan failure was just a random occurrence or you forked at an unlucky point ?Too bad the logs aren't visible anymore but I do see a note at the bottom of https://github.com/nodejs/node/pull/46561/files pointing to test-cluster-primary-error.js - which is not the test you added.
Maybe rebasing your PR would be sufficient?
src: handle wasm out of bound in osx will raise SIGBUS correctly
src: handle wasm out of bound in osx will raise SIGBUS correctly
src: handle wasm out of bound in osx will raise SIGBUS correctly
src: handle wasm out of bound in osx will raise SIGBUS correctly
src: handle wasm out of bound in osx will raise SIGBUS correctly
src: handle wasm out of bound in osx will raise SIGBUS correctly