hashicorp / hashicorp/go-plugin
client.Kill() does not kill child processes
Open
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 511
- Avg merge
- 22h 47m
- Merged PRs (30d)
- 4
Description
When plugin command is started, it may spawn child processes.
However, if `client.Kill()` is called, only the main command is killed and becomes a zombie process due to its child processes are still running.
One possible solution is explained in this blog: https://medium.com/@felixge/killing-a-child-process-and-all-of-its-children-in-go-54079af94773
In particular: `client.go`
```diff
+ cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
...
+ syscall.Kill(-c.process.Pid, syscall.SIGKILL)
- process.Kill()
```
Contributor guide
Assessment
This issue has not been assessed yet.