Plugin raises `heap_get_oob` on certain machines
Describe the bug
Recently on some machines plugin raises these error without clear stack where it happens
Error: failed to handle: failed to invoke plugin: failed to invoke `/Users/ojkwon/github/swc-coverage-instrument/target/wasm32-wasi/debug/swc_plugin_coverage.wasm` as js transform plugin at /Users/ojkwon/github/swc-coverage-instrument/target/wasm32-wasi/debug/swc_plugin_coverage.wasm
Caused by:
0: RuntimeError: out of bounds memory access
1: heap_get_oob
This is not all-time reproducible, but if some machine hits those machine will hit this always.
Input code
-
Config
-
Playground link
No response
Expected behavior
Actual behavior
No response
Version
latest
Additional context
Per bisecting, https://github.com/swc-project/swc/pull/5062 seems causing the issue. It is unclear which specific change is offender, but could be a starting point to dig further.
ref: https://github.com/rkyv/rkyv/issues/291
WSL ubuntu works, Vanilla Ubuntu works, windows 11 works (all with SOME issues, but eventually ran through)
but M1 mac does not
Latest swc_core / swc@core applied workaround this by disabling bytecheck for now. I'll close this, and track re-enabling via #5472.
with swc_core = { version = "0.23.29", } still not work, in M1 mac
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/lyl/work/self/some-tools/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/pages/_document.js")'
Caused by:
0: failed to invoke `/Users/lyl/work/self/some-tools/packages/swc-plugin/dist/swc_plugin.wasm` as js transform plugin at /Users/lyl/work/self/some-tools/packages/swc-plugin/dist/swc_plugin.wasm
1: RuntimeError: unreachable
2: unreachable', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/lyl/work/self/some-tools/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/pages/_error.js")'
Caused by:
0: failed to invoke `/Users/lyl/work/self/some-tools/packages/swc-plugin/dist/swc_plugin.wasm` as js transform plugin at /Users/lyl/work/self/some-tools/packages/swc-plugin/dist/swc_plugin.wasm
1: RuntimeError: out of bounds memory access
2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
after update next.js to 12.3.1-canary.3, it worked
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.