Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

Use tree-kill to properly stop the whole process tree #103

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Use tree-kill to properly stop the whole process tree #103

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 25, 2015

ChildProcess.kill() doesn't stop forked subprocesses. This commit uses tree-kill to properly handle forked subprocesses on all platforms.

@ghost ghost changed the title Use tree-kill to properly stop forked child processes Use tree-kill to properly stop the whole process tree Dec 25, 2015
tree-kill does the right thing on all platforms by default.
@lsegal
Copy link
Owner

lsegal commented Dec 28, 2015

Shouldn't the OS be reaping subprocesses? Can you show a scenario where the forked subprocesses remain around as zombies?

@ghost
Copy link
Author

ghost commented Dec 30, 2015

Hi @lsegal,

yes, there are plenty of situations where subprocesses won't get killed by child_process. The ones I am struggling with are more complex python scripts using asyncio.
A simple one would be a basic go server like this.

package main

import (
    "net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello World!"))
}

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8080", nil)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant