Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uisng @swc/jest crashes with thread '<unnamed>' panicked at 'failed to invoke plugin #7092

Closed
AbhiPrasad opened this issue Mar 16, 2023 · 13 comments
Assignees
Labels
Milestone

Comments

@AbhiPrasad
Copy link

AbhiPrasad commented Mar 16, 2023

Describe the bug

@swc/jest causes jest to crash in CI when using the jest_workaround plugin.

GH action run: https://github.com/getsentry/sentry-javascript/actions/runs/4437301786/jobs/7787193218

PR w/ crash: getsentry/sentry-javascript#7484

SWC versions:

    "@swc/core": "1.3.40",
    "@swc/jest": "0.2.24",

jest_workaround versions:

  "jest_workaround": "0.1.16",

Input code

No response

Config

No response

Playground link

No response

Expected behavior

Not crash when running jest

Actual behavior

> @sentry/core:test

$ jest
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/runner/work/sentry-javascript/sentry-javascript/packages/core/test/lib/base.test.ts")'

Caused by:
    0: RuntimeError: out of bounds memory access
    1: heap_get_oob', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.255.3/src/plugin.rs:228:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Segmentation fault (core dumped)
error Command failed with exit code 139.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Version

1.3.40

Additional context

No response

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2023
@kdy1
Copy link
Member

kdy1 commented Mar 16, 2023

This is not a bug of swc/core

@AbhiPrasad
Copy link
Author

Hey @kdy1 - is this a problem with jest_workaround? Or with jest? What do I need to do to investigate this further?

@kdy1
Copy link
Member

kdy1 commented Mar 17, 2023

I think jest_workaround is the cause.
See https://swc.rs/docs/plugin/selecting-swc-core

@AbhiPrasad
Copy link
Author

Awesome, opened a bug report (magic-akari/swc_mut_cjs_exports#30) with jest_workaround, thank you!

@magic-akari
Copy link
Member

I think jest_workaround is the cause.
See https://swc.rs/docs/plugin/selecting-swc-core

I have updated the swc_core dependencies to the latest version.
The issue did not get resolved, even though it worked fine on my unit tests.
Besides an incompatible version of swc_core, I cannot find other reasons for the out of bounds memory access.
@kdy1 Do you have any leads on this?

@kdy1
Copy link
Member

kdy1 commented Mar 17, 2023

I think #6807 can be relevant.
What's the version of rustc?

@kdy1
Copy link
Member

kdy1 commented Mar 17, 2023

Oh it's pinned. Hmm

@kdy1 kdy1 reopened this Mar 17, 2023
@kdy1 kdy1 added this to the Planned milestone Mar 17, 2023
@kdy1 kdy1 self-assigned this Mar 17, 2023
@AbhiPrasad
Copy link
Author

The branch with the tests failing is on https://github.com/getsentry/sentry-javascript/tree/abhi-build-swc-jest. Please let me know if you need me to debug/run anything to test stuff out.

@kdy1
Copy link
Member

kdy1 commented Mar 17, 2023

@AbhiPrasad Can you run CI again with RUST_BACKTRACE=1?

@kdy1
Copy link
Member

kdy1 commented Mar 17, 2023

I ran in locally with @swc/core@1.3.41 with jest_workaround@0.69 but it worked.
I'm using Apple M1 Max chip

@AbhiPrasad
Copy link
Author

Works for me locally as well - going to hard-pin the deps you mentioned and run in CI.

Unfortunately downloading node is having problems, so CI might flake a couple times while we wait.

@AbhiPrasad
Copy link
Author

AbhiPrasad commented Mar 17, 2023

Weird, hard pinning is now working fine for me - so maybe this was something on my side not sure.

https://github.com/getsentry/sentry-javascript/actions/runs/4447652660/jobs/7809706494?pr=7504

Now just getting errors around jest stuff in CI, but that's probably because jest_workaround is playing weird with old jest version. Will close this for now then, thanks for taking a look!

@kdy1 kdy1 modified the milestones: Planned, v1.3.42 Mar 22, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Apr 21, 2023

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-project swc-project locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants