fix: eventfd leak
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>
This commit is contained in:
parent
0a1f2b4064
commit
9456040acb
@ -271,6 +271,8 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.
|
|||||||
s.eventSendMu.Unlock()
|
s.eventSendMu.Unlock()
|
||||||
return nil, errdefs.ToGRPC(err)
|
return nil, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
|
switch r.ExecID {
|
||||||
|
case "":
|
||||||
if cg, ok := container.Cgroup().(cgroups.Cgroup); ok {
|
if cg, ok := container.Cgroup().(cgroups.Cgroup); ok {
|
||||||
if err := s.ep.Add(container.ID, cg); err != nil {
|
if err := s.ep.Add(container.ID, cg); err != nil {
|
||||||
logrus.WithError(err).Error("add cg to OOM monitor")
|
logrus.WithError(err).Error("add cg to OOM monitor")
|
||||||
@ -278,8 +280,6 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.
|
|||||||
} else {
|
} else {
|
||||||
logrus.WithError(errdefs.ErrNotImplemented).Error("add cg to OOM monitor")
|
logrus.WithError(errdefs.ErrNotImplemented).Error("add cg to OOM monitor")
|
||||||
}
|
}
|
||||||
switch r.ExecID {
|
|
||||||
case "":
|
|
||||||
s.send(&eventstypes.TaskStart{
|
s.send(&eventstypes.TaskStart{
|
||||||
ContainerID: container.ID,
|
ContainerID: container.ID,
|
||||||
Pid: uint32(p.Pid()),
|
Pid: uint32(p.Pid()),
|
||||||
|
Loading…
Reference in New Issue
Block a user