Merge pull request #1965 from crosbymichael/hold-state-lock

Hold shim lock during state
This commit is contained in:
Phil Estes
2018-01-05 12:16:40 -05:00
committed by GitHub

View File

@@ -235,8 +235,8 @@ func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*
// State returns runtime state information for a process // State returns runtime state information for a process
func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) { func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock()
p := s.processes[r.ID] p := s.processes[r.ID]
s.mu.Unlock()
if p == nil { if p == nil {
return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process id %s not found", r.ID) return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process id %s not found", r.ID)
} }