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

Crashes with libc++abi: terminating with uncaught exception of type Napi::Error #2972

Closed
6 tasks done
olalonde opened this issue Mar 7, 2023 · 3 comments
Closed
6 tasks done
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@olalonde
Copy link

olalonde commented Mar 7, 2023

Describe the bug

I've been getting a process crash using vitest when using either bcrypt or argon2 (so I assume it's not a bug with either but something that vitest is doing).

libc++abi: terminating with uncaught exception of type Napi::Error

I assume it's an issue with tinypool? tinylibs/tinypool#48

Does vitest use multiples processes when threads are disabled?

Reproduction

I couldn't easily reproduce the issue. I believe it has something to do with multithreading and usage of native libraries like bcrypt or argon2.

System Info

System:
    OS: macOS 12.3
    CPU: (8) arm64 Apple M1
    Memory: 111.63 MB / 16.00 GB
    Shell: 5.8 - /opt/homebrew/bin/zsh
  Binaries:
    Node: 19.6.0 - ~/Library/Caches/fnm_multishells/72546_1678121779252/bin/node
    npm: 9.4.0 - ~/Library/Caches/fnm_multishells/72546_1678121779252/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Safari: 15.4

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

Does vitest use multiples processes when threads are disabled?

Since 0.29.0, Vitest uses Worker Threads by default. If threads is false, or --no-threads flag is passed, it fallbacks to child_process.

@servettonga
Copy link

servettonga commented Sep 16, 2023

I had this with bcrypt and finally switched to argon2. But now, I get it while asserting async function to save an entry into mongodb. I will share if I can reproduce it.

Edit: It throws this Napi::Error if expect.any() is empty, If I add --no-threads flag, I can see the log that explains the cause of error.

@sheremet-va sheremet-va added p2-edge-case Bug, but has workaround or limited in scope (priority) and removed has workaround labels Feb 16, 2024
@sheremet-va
Copy link
Member

Use --pool=forks if you experience segfaults. Some native packages don't support running in separate threads.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
None yet
Development

No branches or pull requests

3 participants