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

Getting Node low level errors running vitest #3816

Closed
6 tasks done
lemoustachiste opened this issue Jul 26, 2023 · 6 comments
Closed
6 tasks done

Getting Node low level errors running vitest #3816

lemoustachiste opened this issue Jul 26, 2023 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@lemoustachiste
Copy link

Describe the bug

So I am testing migration of my project from jest to vitest.

But when I run vitest run through npm run test, I keep getting Node errors such as follows:

node(39994,0x7000083d9000) malloc: *** error for object 0x600002c44cd0: pointer being freed was not allocated
node(39994,0x700006fca000) malloc: *** error for object 0x600002c44cd0: pointer being freed was not allocated
node(39994,0x7000083d9000) malloc: *** set a breakpoint in malloc_error_break to debug
node(39994,0x700006fca000) malloc: *** set a breakpoint in malloc_error_break to debug

This error does not even get to a point of running tests.

Or if some tests start running, then they stop unexpectedly with the following error:

[1]    31930 segmentation fault  npm run test

Errors occur with both node 16.20.0 and 18.16.1.

My tests are all TS, so is my project.

Any clue what could be causing this?

Reproduction

Not sure if I can provide a repro at this point.

System Info

System:
    OS: macOS 13.5
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 21.56 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.12.1 - ~/work/cert-verifier-js/node_modules/.bin/npm
  Browsers:
    Chrome: 115.0.5790.102
    Safari: 16.6
  npmPackages:
    vitest: ^0.33.0 => 0.33.0

Used Package Manager

npm

Validations

@github-actions
Copy link

Hello @lemoustachiste. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@lemoustachiste
Copy link
Author

@sheremet-va would sharing the repo with a work branch for vitest work as a repro for you? On simpler code I cannot replicate the issue.

@sheremet-va
Copy link
Member

@sheremet-va would sharing the repo with a work branch for vitest work as a repro for you? On simpler code I cannot replicate the issue.

Yes

@lemoustachiste
Copy link
Author

Please have a look at this branch: https://github.com/blockchain-certificates/cert-verifier-js/tree/chore/vitest

just:

  • npm i
  • npm test (single run)

I did not get the mem alloc failure just now, but it still does not complete with segmentation fault at unexpected stages it looks like.

I haven't investigated much yet, this is exploratory work to try and move away from jest.

Thanks

@sheremet-va sheremet-va added help wanted Extra attention is needed and removed needs reproduction labels Jul 28, 2023
@sheremet-va
Copy link
Member

This error type usually happens when an application cannot work in multi-threaded mode. In this case, it is recommended to disable threads: run vitest --no-threads instead of vitest.

@AriPerkkio
Copy link
Member

Fixed by #3925 and #4172.

Vitest 1.0.0-beta has now --pool=forks which uses multiple node:child_process in parallel. The previous --no-threads was using a single node:child_process.

If the code you are testing is incompatible with node:worker_threads, switch to --pool=forks. If you run into same error with that pool, feel free to open new issue with minimal reproduction.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants