-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Killing subprocess running run-script executor leaves orphaned processes #11782
Comments
Worth noting that this also affects the task runner in general. ForkedProcessTaskRunner SIGTERMs its child processes when the current process receives SIGINT/SIGTERM/SIGHUP, but if one of those child processes is running run-script, the script being run won't be killed |
It may be related to #11722 |
I have probably hit the same issue with run-command executor. I'm trying to move some yarn scripts to own targets to related projects. |
This is also an issue with Ie. write an executor that spawns another nx run process. nx process runs a target defined with |
Do you have any updates on this issue? I'm having a lot of problems with the port still being used when the command is killed with |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
I don't have the time to re-do the repro right now (and stackblitz is no longer playing nicely with nx) - any chance someone else on this thread can put together an updated repro for the latest nx version? |
@luxaritas I am not 100% sure what your stackblitz was doing before.... but.... something is definitely broken with this |
Current Behavior
If runExecutor is called within a child process invoking the run-script executor, killing the child process (ie, before it has finished running) leaves the executed script running
Expected Behavior
The executed script should be signaled to exit
From my understanding, this is caused by run-script calling execSync - Node never cleans up child processes when it exists. Presumably,
exec
should be used instead, so that a handle to the child process can be retained, so that signal handlers installed on the current process can callkill
when the current process exists, similarly to how run-commands works in parallel mode (that said - this issue is also presumably present in run-commands serial mode, which also uses execsync).Steps to Reproduce
https://stackblitz.com/edit/node-k9o4py?file=main.js,proc.js - run
npm start
Failure Logs
Environment
(This is for the stackblitz environment used for this repro above)
The text was updated successfully, but these errors were encountered: