Skip to content

Commit 883b41b

Browse files
author
Yuanhong Peng
committed
Remove kill(0) in handleSigkilledShim()
fix containerd#1222 kill(0) seems useless here because we have already waited shim to exit through `<-p.cmdDoneCh` in following steps. Signed-off-by: Yuanhong Peng <pengyuanhong@huawei.com>
1 parent 95adb6d commit 883b41b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

runtime/process.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,6 @@ func (p *process) handleSigkilledShim(rst uint32, rerr error) (uint32, error) {
300300
return rst, rerr
301301
}
302302

303-
// Possible that the shim was SIGKILLED
304-
e := unix.Kill(p.cmd.Process.Pid, 0)
305-
if e != syscall.ESRCH {
306-
return rst, rerr
307-
}
308-
309303
// The shim was SIGKILLED
310304
// We should get the container state first
311305
// to make sure the container is not in
@@ -318,7 +312,11 @@ func (p *process) handleSigkilledShim(rst uint32, rerr error) (uint32, error) {
318312
}
319313

320314
// Ensure we got the shim ProcessState
321-
<-p.cmdDoneCh
315+
select {
316+
case <-p.cmdDoneCh:
317+
case <-time.After(2 * time.Minute):
318+
return rst, fmt.Errorf("could not get the shim ProcessState within two minutes")
319+
}
322320

323321
shimStatus := p.cmd.ProcessState.Sys().(syscall.WaitStatus)
324322
if shimStatus.Signaled() && shimStatus.Signal() == syscall.SIGKILL {

0 commit comments

Comments
 (0)