Skip to content

Commit 8314d27

Browse files
committed
update code for runc related changes part 2
Signed-off-by: Arjun Raja Yogidas <arjunry@amazon.com>
1 parent 65e1450 commit 8314d27

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

runtime/runc_jailer.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,13 +675,19 @@ func (j runcJailer) Stop(force bool) error {
675675
return j.runcClient.Kill(j.ctx, j.vmID, int(signal), &runc.KillOpts{All: true})
676676
}
677677

678-
// IsRunning checks if the runc container is still running.
678+
// IsRunning checks if the runc container's init process is still alive.
679679
func (j *runcJailer) IsRunning(ctx context.Context) bool {
680680
state, err := j.runcClient.State(ctx, j.vmID)
681681
if err != nil {
682682
return false
683683
}
684-
return state.Status == "running" || state.Status == "created" || state.Status == "paused"
684+
// Check if the init process (Firecracker) is still alive
685+
if state.Pid > 0 {
686+
// kill with signal 0 checks if process exists without sending a signal
687+
err := syscall.Kill(state.Pid, 0)
688+
return err == nil
689+
}
690+
return false
685691
}
686692

687693
// setupCacheTopology will copy indexed contents from the cacheTopologyPath to

0 commit comments

Comments
 (0)