Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix concurrent map operation in the access log module #131

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Release Notes.
* Fixed the issue where `conntrack` could not find the Reply IP in the access log module.
* Fix errors when compiling C source files into eBPF bytecode on a system with Linux headers version 6.2 or higher.
* Fixed `ip_list_rcv` probe is not exist in older linux kernel.
* Fix concurrent map operation in the access log module.

#### Documentation

Expand Down
4 changes: 3 additions & 1 deletion pkg/accesslog/common/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ func (c *ConnectionManager) RecheckAllProcesses(processes map[int32][]api.Proces
processInBPF[int32(pid)] = true
}

c.monitoringProcessLock.RLock()
defer c.monitoringProcessLock.RUnlock()
// make sure BPF and user space are consistent
for pid := range processInBPF {
if _, ok := c.monitoringProcesses[pid]; !ok {
Expand Down Expand Up @@ -575,7 +577,7 @@ func (c *ConnectionManager) OnBuildConnectionLogFinished() {
return
}
// already mark as deletable or process not monitoring
shouldDelete := con.MarkDeletable || len(c.monitoringProcesses[int32(con.PID)]) == 0
shouldDelete := con.MarkDeletable || !c.ProcessIsMonitor(con.PID)

if shouldDelete {
deletableConnections = append(deletableConnections, key)
Expand Down
Loading