Make raw_exec processes cleanup function more precise.

This commit is contained in:
Marcin Matlaszek 2018-02-06 21:08:14 +01:00
parent bb36c122e2
commit 6019a88824
No known key found for this signature in database
GPG Key ID: E0A3AF6CF0EF47DB
1 changed files with 2 additions and 2 deletions

View File

@ -453,7 +453,7 @@ func ClientCleanup(ic *dstructs.IsolationConfig, pid int) error {
}
// Cleanup any still hanging user processes
func (e *UniversalExecutor) cleanupUserLeftovers(proc *os.Process) error {
func (e *UniversalExecutor) cleanupChildProcesses(proc *os.Process) error {
// If new process group was created upon command execution
// we can kill the whole process group now to cleanup any leftovers.
if e.cmd.SysProcAttr != nil && e.cmd.SysProcAttr.Setpgid {
@ -493,7 +493,7 @@ func (e *UniversalExecutor) Exit() error {
if err != nil {
e.logger.Printf("[ERR] executor: can't find process with pid: %v, err: %v",
e.cmd.Process.Pid, err)
} else if err := e.cleanupUserLeftovers(proc); err != nil && err.Error() != finishedErr {
} else if err := e.cleanupChildProcesses(proc); err != nil && err.Error() != finishedErr {
merr.Errors = append(merr.Errors,
fmt.Errorf("can't kill process with pid: %v, err: %v", e.cmd.Process.Pid, err))
}