Skip to content

Commit

Permalink
pid-to-container map revalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
apetruhin committed Apr 27, 2022
1 parent c5a3c7f commit 3266fed
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions containers/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ func (r *Registry) handleEvents(ch <-chan ebpftracer.Event) {
for {
select {
case now := <-gcTicker.C:
for pid, c := range r.containersByPid {
cg, err := proc.ReadCgroup(pid)
if err != nil {
delete(r.containersByPid, pid)
if c != nil {
c.onProcessExit(pid, false)
}
continue
}
if c != nil && cg.Id != c.cgroup.Id {
delete(r.containersByPid, pid)
c.onProcessExit(pid, false)
}
}

for id, c := range r.containersById {
if !c.Dead(now) {
continue
Expand Down

0 comments on commit 3266fed

Please sign in to comment.