swc icon indicating copy to clipboard operation
swc copied to clipboard

Plugin raises `heap_get_oob` on certain machines

Open kwonoj opened this issue 3 years ago • 2 comments

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.

kwonoj avatar Aug 06 '22 03:08 kwonoj

ref: https://github.com/rkyv/rkyv/issues/291

kwonoj avatar Aug 06 '22 04:08 kwonoj

WSL ubuntu works, Vanilla Ubuntu works, windows 11 works (all with SOME issues, but eventually ran through)

but M1 mac does not

alekangelov avatar Aug 06 '22 10:08 alekangelov

Latest swc_core / swc@core applied workaround this by disabling bytecheck for now. I'll close this, and track re-enabling via #5472.

kwonoj avatar Aug 22 '22 22:08 kwonoj

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

liaoyinglong avatar Sep 19 '22 06:09 liaoyinglong

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.

swc-bot avatar Oct 19 '22 12:10 swc-bot