hashicorp / hashicorp/go-plugin

client.Kill() does not kill child processes

Open
#136 1 comment 1 reaction 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.