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

Windows: Execa is leaking processes when used with readline #429

Closed
Ciantic opened this issue Jun 8, 2020 · 14 comments
Closed

Windows: Execa is leaking processes when used with readline #429

Ciantic opened this issue Jun 8, 2020 · 14 comments

Comments

@Ciantic
Copy link

Ciantic commented Jun 8, 2020

Repro is here: https://github.com/Ciantic/execa-readline-problems

There is also a long spanning discussion because it leads to snowpack leaking processes in Windows: https://www.pika.dev/npm/snowpack/discuss/295

It seems like the cleanup is not working correctly when readline is used. Also I think there is some race condition here, because I have managed to make scripts where the execa cleanup happens sometimes, but sometimes not. So it's not deterministic.

node --version: v12.18.0

@sindresorhus
Copy link
Owner

Can you check whether the problem is also reproducible on Node.js 14? I don't have a Windows VM right now, so I cannot test.

Can you also try replacing const myProcess = execa('tsc --noEmit --watch', {shell: true, cleanup: true}); with const myProcess = execa.command('tsc --noEmit --watch', {cleanup: true});?

@MatejBransky
Copy link

I can't reproduce it with PowerShell (v5.1.19041.1) Node.js v12.14.0 on Windows 10 (version 2004 OS build 19041.264). In this environment it succesfully killed the process.

@Ciantic
Copy link
Author

Ciantic commented Jun 10, 2020

@MatejBransky interesting. Notice that for me it has behaved like this: It worked e.g. 10 times a row and then it stopped working for a while etc.

That is the reason I suspect there is race condition.

@MatejBransky
Copy link

@Ciantic Ok and how to reproduce it? I've tried it multiple times and it still worked.

@Ciantic
Copy link
Author

Ciantic commented Jun 10, 2020

@MatejBransky if there is a race condition, it might not be reproducible on all systems and setups. Because something is delayed just enough in my machine, or works faster in yours.

@Ciantic
Copy link
Author

Ciantic commented Jun 10, 2020

@MatejBransky If it works for you, you shouldn't waste more time with this. I have to investigate further if it's reproducible only on my setup for some reason. You can see from here: https://www.pika.dev/npm/snowpack/discuss/295 it's been a painful to debug.

@MatejBransky
Copy link

@Ciantic I've come here from your pika discussion and I would like to help but unfortunately I don't know how. 😒

@Ciantic
Copy link
Author

Ciantic commented Jun 12, 2020

I tested this in the VM. The Windows Sandbox with Windows 10 2004. It's still reproducible with this setup, so yes I would conclude it's broken somehow.

Tested node versions:
v12.18.0 32bit
v14.4.0 32bit

I updated my repository with repro, nothing that changes the behavior.

@ManiacDC
Copy link

I can also reproduce this, Windows 10 1909
node v12.14.1

Tried from both bash and powershell

@ManiacDC
Copy link

ManiacDC commented Aug 14, 2020

Worth noting, I can't reproduce this using the same example code with execa 1.0.0.

@Ciantic
Copy link
Author

Ciantic commented Aug 14, 2020

It's sometimes not reproducible, so if you managed to reproduce it once, it might still be reproducible.

@ehmicky
Copy link
Collaborator

ehmicky commented Aug 14, 2020

More information in #433 (which seems to be a duplicate issue).

Could you try to pass the windowsHide: false option to Execa and see if this solves the problem?

@ManiacDC
Copy link

I just tested this specific issue with windowsHide: false and it fixed this one too, so #433 and this issue do appear to be duplicates.

@ehmicky
Copy link
Collaborator

ehmicky commented Aug 18, 2020

Thanks for checking this out @ManiacDC! Closing this issue as duplicate then.

@ehmicky ehmicky closed this as completed Aug 18, 2020
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

No branches or pull requests

5 participants