-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Command::detach can cause zombie processes #17176
Comments
I'd be glad to take a look at this. Is this a blocking issue for skylight? |
Our requirements are pretty simple, so we are going to just bind http://man7.org/linux/man-pages/man3/daemon.3.html for now. Our parent process stays around for a while and could repeatedly spawn of daemons so zombies would be a pretty bad thing in our case. |
I wonder how this sorted out with the IO RFC. |
This was removed from |
Add a new method `CommandExt::session_leader(&mut self, on: bool)` to create a new session (cf. `setsid(2)`) for the child process. This means that the child is the leader of a new process group. The parent process remains the child reaper of the new process. This is not enough to create a daemon process. The *init* process should be the child reaper of a daemon. This can be achieved if the parent process exit. Moreover, a daemon should not have a controlling terminal. To acheive this, a session leader (the child) must spawn another process (the daemon) in the same session. cc rust-lang/rfcs#941 cc #17176
Fix impl trait params not being counted properly Fixes the other thing in rust-lang/rust-analyzer#17173, this just rolls back a change from rust-lang/rust-analyzer#17175 and adds a comment as to what it does
Properly spawning a detached process requires double forking in order to avoid zombie processes:
http://www.linuxjedi.co.uk/2014/02/why-use-double-fork-to-daemonize.html
I did not see this happening in https://github.com/rust-lang/rust/blob/master/src/libnative/io/process.rs
cc @aturon @alexcrichton
The text was updated successfully, but these errors were encountered: