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
Segmentation faults in napi v2.10.3 and later #1504
Comments
Hmm, with 2.10.2, I see a different segfault involving
(This does not occur when I switch to |
@devongovett how could I reproduce that, I tried:
but it succeeded without any error. |
On the latest commit to that branch I had pinned to v2.10.2. You also might need a large project to test with. I'll get you a repro soon. |
@devongovett yes, I changed |
hey sorry for the slow response @Brooooooklyn! I put together a reproduction repo here: https://github.com/devongovett/napi-repro. The steps to reproduce are in the readme. Not sure if it matters, but fwiw I'm testing on an M1 Ultra Mac Studio. I've seen it crash on both Node 16 and 18. Also we noticed that this doesn't appear limited to the source map package. I also see the same segfaults on other packages using napi classes, including @parcel/hash. Sometimes there is also a double free error before the crash, but that seems to happen more on Node 16. |
Also it seems to be more likely to crash the more threads you give it. You can set the PARCEL_WORKERS environment variable, which defaults to the number of cores on your machine. |
I'm trying to update the Parcel source map package to the latest napi version (parcel-bundler/source-map#120). In v2.10.3 and later versions, I am getting many different segmentation faults when running within a Parcel build. In v2.10.2, I haven't been able to reproduce these.
Here's another one:
And another:
I did try removing jemalloc and using the system allocator, but it still crashes so I don't think that's the problem. Seems like maybe the pointer to
self
that's being passed to the class methods is somehow wrong or already dropped.Looking at the release notes for v2.10.3, #1395 and #1399 stand out as potentially related but not sure. I can keep digging but not really sure what to look for.
Keep in mind that Parcel runs in a multi-threaded Worker environment, so perhaps that is related as well.
The text was updated successfully, but these errors were encountered: