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

fix: crash with odd cpu counts #1597

Merged
merged 1 commit into from Jul 5, 2022
Merged

Conversation

yamazaki-sensei
Copy link
Contributor

if os.cpu().length returns odd number, vitest crashes like this:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
RangeError: Invalid array length
 ❯ new ThreadPool node_modules/tinypool/dist/esm/index.js:467:30
 ❯ new Tinypool node_modules/tinypool/dist/esm/index.js:739:31
 ❯ createPool node_modules/vitest/dist/chunk-vite-node-externalize.1efbe319.mjs:7057:16
 ❯ node_modules/vitest/dist/chunk-vite-node-externalize.1efbe319.mjs:10406:21
 ❯ Vitest.runFiles node_modules/vitest/dist/chunk-vite-node-externalize.1efbe319.mjs:10422:7
 ❯ Vitest.start node_modules/vitest/dist/chunk-vite-node-externalize.1efbe319.mjs:10349:5
 ❯ startVitest node_modules/vitest/dist/chunk-vite-node-externalize.1efbe319.mjs:11095:5
 ❯ CAC.start node_modules/vitest/dist/cli.mjs:667:9

This PR fixes this error.

@netlify
Copy link

netlify bot commented Jul 5, 2022

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit bb2ad44
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/62c3d1f712ebbc0009ce153c
😎 Deploy Preview https://deploy-preview-1597--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sheremet-va
Copy link
Member

By odd you mean float? I don't see why 3 is invalid array number 😄

@sheremet-va
Copy link
Member

By odd you mean float? I don't see why 3 is invalid array number 😄

Ah, I see you mean CPU, and not the result 😄

@antfu antfu merged commit 0a642c6 into vitest-dev:main Jul 5, 2022
@yamazaki-sensei yamazaki-sensei deleted the fix/odd-cpus branch July 5, 2022 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants