From 2b29a92a64a3fe51a36046a17559ab9d676f5b3e Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 5 Jan 2018 11:13:47 -0500 Subject: [PATCH] Hold shim lock during state Helps with #1935 This hold the shim lock during the state call to make sure that the task does not get deleted during a state call. Signed-off-by: Michael Crosby --- linux/shim/service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/shim/service.go b/linux/shim/service.go index 129b1790f..1150d1cc8 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -235,8 +235,8 @@ func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (* // State returns runtime state information for a process func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) { s.mu.Lock() + defer s.mu.Unlock() p := s.processes[r.ID] - s.mu.Unlock() if p == nil { return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process id %s not found", r.ID) }