Skip to content

Commit 8a9d693

Browse files
author
Kazuyoshi Kato
committed
[release/1.6] Stats() shouldn't assume s.container is non-nil
Like other exported methods, Stats() shouldn't assume s.container is non-nil. Fixes #7468. Signed-off-by: Kazuyoshi Kato <[email protected]> (cherry picked from commit 49a54e2) Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent 74e9e4c commit 8a9d693

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

runtime/v2/runc/v1/service.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,11 @@ func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (*pt
597597
}
598598

599599
func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.StatsResponse, error) {
600-
cgx := s.container.Cgroup()
600+
container, err := s.getContainer()
601+
if err != nil {
602+
return nil, err
603+
}
604+
cgx := container.Cgroup()
601605
if cgx == nil {
602606
return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "cgroup does not exist")
603607
}

0 commit comments

Comments
 (0)