Skip to content

Commit

Permalink
Stats() shouldn't assume s.container is non-nil
Browse files Browse the repository at this point in the history
Like other exported methods, Stats() shouldn't assume s.container is
non-nil.

Fixes #7468.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
  • Loading branch information
kzys committed Oct 12, 2022
1 parent 2716289 commit 49a54e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/v2/runc/v1/service.go
Expand Up @@ -596,7 +596,11 @@ func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (*pt
}

func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.StatsResponse, error) {
cgx := s.container.Cgroup()
container, err := s.getContainer()
if err != nil {
return nil, err
}
cgx := container.Cgroup()
if cgx == nil {
return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "cgroup does not exist")
}
Expand Down

0 comments on commit 49a54e2

Please sign in to comment.