mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 21:24:36 +00:00
runtime: reap force killed processes
reap child processes after sending SIGKILL Fixes #5739 Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
parent
8246de821f
commit
92ebe61fea
@ -375,8 +375,19 @@ outer:
|
||||
if pidRunning {
|
||||
// Force process to die
|
||||
if err = syscall.Kill(pid, syscall.SIGKILL); err != nil {
|
||||
if err == syscall.ESRCH {
|
||||
logger.WithField("pid", pid).Warnf("process already finished")
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("Failed to stop process %v: %s", pid, err)
|
||||
}
|
||||
|
||||
for {
|
||||
_, err := syscall.Wait4(pid, nil, 0, nil)
|
||||
if err != syscall.EINTR {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user