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

No notifications when issuing kill -9 to the child process #58

Open
szhem opened this issue Feb 6, 2016 · 1 comment
Open

No notifications when issuing kill -9 to the child process #58

szhem opened this issue Feb 6, 2016 · 1 comment

Comments

@szhem
Copy link

szhem commented Feb 6, 2016

Hello,

Is it possible to know in the parent process if the state of the child process changes?

I'm trying to spawn "sh -c 'sleep 60'", then kill this child process with kill -9 from the shell and this child process starts to be in the defunct state until parent process exits. At the same time no notifications received within NuProcessHandler#onExit.

Kind Regards,
Sergey

@thraidh
Copy link

thraidh commented Nov 30, 2020

When you spawn sh -c 'sleep 60' you are actually spawning a shell, that spawns a sleep 60.

If you kill the shell using kill, kill -9 or process.destroy(..) then only the shell is killed, while the sleep continues to live. It is reparented to some parent (usually your shell or PID 1), but still blocks the shell from finishing and it stays in defunct or zombie state.

process.waitFor(..) will also block, as long as the shell is not completely gone.

If you also kill the sleep 60 or just wait until it dies on its own, process.waitFor(..) will return and NuProcessHandler#onExit is executed.

See also #78 for a request to delete all child processes, so you can avoid this situation.

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

2 participants