From fcf3b275fcd404ddf5fe75d5629d2168742ec0d3 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Thu, 15 Apr 2021 13:48:08 +0800 Subject: [PATCH] Add lock for ListPids Signed-off-by: Shiming Zhang --- runtime/v1/shim/service.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/v1/shim/service.go b/runtime/v1/shim/service.go index 2f5a8c2f2..50ac869d4 100644 --- a/runtime/v1/shim/service.go +++ b/runtime/v1/shim/service.go @@ -397,6 +397,9 @@ func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*sh return nil, errdefs.ToGRPC(err) } var processes []*task.ProcessInfo + + s.mu.Lock() + defer s.mu.Unlock() for _, pid := range pids { pInfo := task.ProcessInfo{ Pid: pid,