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

netlify dev leaves behind zombie processes on Windows #3251

Closed
kamsar opened this issue Aug 25, 2021 · 7 comments · Fixed by #3278
Closed

netlify dev leaves behind zombie processes on Windows #3251

kamsar opened this issue Aug 25, 2021 · 7 comments · Fixed by #3278
Labels
area: command: dev type: bug code to address defects in shipped code

Comments

@kamsar
Copy link

kamsar commented Aug 25, 2021

Describe the bug

netlify dev leaves behind zombie processes on windows after ctrl-c. This leaves copies of dev tools like tsc, esbuild, nextjs, etc in watch mode running after the dev session is terminated.

To Reproduce

Steps to reproduce the behavior:

https://github.com/kamsar/nfcli-sigint-zombies#readme

Configuration

See repro repository above for steps and reproducible scenario. Tests ran on Windows 10 19042, node 14.15.4, npm and yarn both. It seems to occur on any process spawned by netlify dev - tsc, npm-run-all, esbuild, node scripts, etc.

Expected behavior

netlify-dev should not leave behind zombie processes - and it did not used to, this started happening a month or two ago.

@kamsar kamsar added the type: bug code to address defects in shipped code label Aug 25, 2021
@erezrokah
Copy link
Contributor

Probably related to

frameworkProcess.kill('SIGTERM', { forceKillAfterTimeout: 500 })

@kamsar
Copy link
Author

kamsar commented Aug 26, 2021

@erezrokah I did mess around with that line a bit to see if I could get it to work before submitting the issue, but it seemed resistant to the things I tried: firing SIGINT instead of SIGTERM, passing on the same signal that came in (except exit which is not a signal), and passing on only SIGINT in case it was triggered by multiple events in sequence (SIGINT, exit).

@joshmossas
Copy link

I've been having this same issue.

To deal with this I've been running the following in my CLI after killing netlify dev to manually kill all nodejs processes

 taskkill /F /IM node.exe /T

@erezrokah
Copy link
Contributor

@erezrokah I did mess around with that line a bit to see if I could get it to work before submitting the issue, but it seemed resistant to the things I tried: firing SIGINT instead of SIGTERM, passing on the same signal that came in (except exit which is not a signal), and passing on only SIGINT in case it was triggered by multiple events in sequence (SIGINT, exit).

Thanks @kaganjd, if you feel like messing with this a bit more, maybe using kill-tree can help. We use it in our tests

kill(ps.pid)

@Xenonym
Copy link
Contributor

Xenonym commented Aug 31, 2021

The issue is that execa defaults to windowsHide: true, which seems to interfere with terminating child processes: sindresorhus/execa#433. Setting windowsHide: false would fix the issue.

Other projects have also encountered this issue with execa's defaults and Windows: FredKSchott/snowpack#1022, lerna/lerna#2946.

@ehmicky
Copy link
Contributor

ehmicky commented Aug 31, 2021

Thanks @Xenonym for fixing this in #3278 🎉

This has been released with 6.8.1.

@kamsar
Copy link
Author

kamsar commented Aug 31, 2021

Can confirm 6.8.1 works for me. Much appreciated! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: command: dev type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants