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: send SIGKILL on unresponsive process #395

Merged

Conversation

sadkebab
Copy link
Contributor

@sadkebab sadkebab commented Nov 17, 2023

Fixes #394

This fix checks if the child is responsive before sending a SIGKILL. If it is, we assume the child doesn't want to exit by ignoring the SIGINT.

src/cli.ts Outdated
* a SIGKILL if the childProcess.on('close') handler
* defined below is not called within 10ms.
*/
setTimeout(() => childProcess.kill('SIGKILL'), 10);
Copy link
Owner

@privatenumber privatenumber Nov 22, 2023

Choose a reason for hiding this comment

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

This will break cases where the child handles the SIGINT signal, either by refusing to close or running a slow handler:

process.on('SIGINT', () => {
	// slow code
});

@privatenumber privatenumber changed the title Sending sigkill to potentially stuck children process fix: send SIGKILL on unresponsive process Nov 23, 2023
@privatenumber privatenumber merged commit fb61588 into privatenumber:develop Nov 23, 2023
@privatenumber
Copy link
Owner

🎉 This issue has been resolved in v4.4.0

If you appreciate this project, please consider supporting this project by sponsoring ❤️ 🙏

@sadkebab sadkebab deleted the fix/stuck-children-process branch December 4, 2023 21:52
@zaripych zaripych mentioned this pull request Dec 25, 2023
6 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SIGINT has no effect if tsx is running an infinite loop
2 participants