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: try fix node crash #335

Merged
merged 4 commits into from
Dec 27, 2021
Merged

fix: try fix node crash #335

merged 4 commits into from
Dec 27, 2021

Conversation

Demivan
Copy link
Member

@Demivan Demivan commented Dec 27, 2021

Fixes #319

Workers that are not in use are in unref state
and process can shutdown gracefully anyway
As there is no pending work process will shutdown
gracefully anyway
@netlify
Copy link

netlify bot commented Dec 27, 2021

✔️ Deploy Preview for vitest-dev ready!

🔨 Explore the source changes: e8759b8

🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/61c9fa4008a82600075c92ea

😎 Browse the preview: https://deploy-preview-335--vitest-dev.netlify.app

@Demivan
Copy link
Member Author

Demivan commented Dec 27, 2021

@antfu I was about to create pull request. 🙂
f7bdb90 is not enough. Terminating process causes the crash too.

@@ -101,9 +101,6 @@ async function run(cliFilters: string[], options: UserConfig) {
if (!ctx.config.watch)
await ctx.close()
}

if (!ctx.config.watch)
process.exit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't have this, the process might be hanging due to unresolved side effects

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terminating the process causes the crash too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you have an issue with unresolved effects or this is just a precaution?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodeJs workers are really fragile. If there anything going on inside worker (open port, file handle), terminating it causes a crash.

Copy link
Member

@userquin userquin Dec 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Demivan With your changes windows will run ok, testing last changes (3 consecutive nr ci + 3 sequences alternating pnpm run test:cli and pnpm run test:all)...

Copy link
Member

@antfu antfu Dec 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be dangerous as a hanging process will eat up all your CI time 👀. At some point, there are some cases, but not very sure if it still applies since we migrate to workers (but there is still a non-worker mode). Could never be too prepared :P

@antfu antfu changed the title fix: fix node crash fix: try fix node crash Dec 27, 2021
@antfu antfu merged commit 5f095eb into vitest-dev:main Dec 27, 2021
@Demivan Demivan deleted the fix-node-crash branch December 29, 2021 11:15
JakeGinnivan pushed a commit to JakeGinnivan/vitest that referenced this pull request Jan 8, 2022
chaii3 pushed a commit to chaii3/vitest that referenced this pull request May 13, 2022
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.

NodeJs fatal error when running tests
3 participants