Skip to content

Commit

Permalink
Fix concurrent map operation in the access log module (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrproliu authored Jun 17, 2024
1 parent 393fa59 commit 32a0c5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

0 comments on commit 32a0c5e

Please sign in to comment.