node icon indicating copy to clipboard operation
node copied to clipboard

Child Process Leak

Open ronag opened this issue 5 months ago • 4 comments

I'm spawning processes and using SIGSTOP/SIGCONT to suspend/resume the processes. However, I've noticed that the processes will continue living even after 'close' having been emitted:

e.g.

# ps -ax | grep ffmpeg | grep 40496
40496 ?        Tl     0:05 ffmpeg ...

However, I have received a 'close' event from the process so it should have exited. I notice that it is in "T" state (stopped by job control signal) which is suspect is somehow related.

It seems to me that the 'close' event is somehow incorrectly emitted, or that a process can receive a SIGSTOP after the 'close' signal.

ronag avatar Dec 29 '23 07:12 ronag

I could work on this, do you have a repro case? Having two hypothesis makes it a bit complicated

juanarbol avatar Dec 31 '23 06:12 juanarbol

Haven't been able to reproduce. Seems timing dependent.

ronag avatar Dec 31 '23 08:12 ronag

Workaround is to always use execFile with kill.

ronag avatar Dec 31 '23 08:12 ronag

Something like cp.execFile('kill')?

juanarbol avatar Dec 31 '23 10:12 juanarbol