Skip to content

Commit 1cd5e6d

Browse files
events_enrich: do not try to close nil channel (#2000)
Fixes: #1999 Commit 9be596e ("enrich: fix lock in cleanup logic (cgroup_rmdir)...") added a channel closure for the cgroup_rmdir but, if container was started before tracee, the channel might not exist. Check for channel existance before closing it.
1 parent 9639325 commit 1cd5e6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/ebpf/events_enrich.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,12 @@ func (t *Tracee) enrichContainerEvents(ctx gocontext.Context, in <-chan *trace.E
109109
}
110110
}
111111
}
112+
close(queues[cgroupId])
112113
}
113-
bLock.RUnlock()
114-
114+
bLock.RUnlock() // give de-queue events a chance
115115
bLock.Lock()
116116
delete(enrichDone, cgroupId)
117117
delete(enrichInfo, cgroupId)
118-
close(queues[cgroupId])
119118
delete(queues, cgroupId)
120119
bLock.Unlock()
121120

0 commit comments

Comments
 (0)