Skip to content

Commit

Permalink
fix: eventfd leak
Browse files Browse the repository at this point in the history
Only start watching the cgroup for OOMs when the first process starts
instead of on every process.

Signed-off-by: Seth Pellegrino <spellegrino@newrelic.com>
  • Loading branch information
sethp-nr committed Jan 13, 2020
1 parent 0a1f2b4 commit 9456040
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions runtime/v2/runc/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.
s.eventSendMu.Unlock()
return nil, errdefs.ToGRPC(err)
}
if cg, ok := container.Cgroup().(cgroups.Cgroup); ok {
if err := s.ep.Add(container.ID, cg); err != nil {
logrus.WithError(err).Error("add cg to OOM monitor")
}
} else {
logrus.WithError(errdefs.ErrNotImplemented).Error("add cg to OOM monitor")
}
switch r.ExecID {
case "":
if cg, ok := container.Cgroup().(cgroups.Cgroup); ok {
if err := s.ep.Add(container.ID, cg); err != nil {
logrus.WithError(err).Error("add cg to OOM monitor")
}
} else {
logrus.WithError(errdefs.ErrNotImplemented).Error("add cg to OOM monitor")
}
s.send(&eventstypes.TaskStart{
ContainerID: container.ID,
Pid: uint32(p.Pid()),
Expand Down

0 comments on commit 9456040

Please sign in to comment.