This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/main by this push:
     new 32a0c5e  Fix concurrent map operation in the access log module (#131)
32a0c5e is described below

commit 32a0c5ec8e845e3cd762c260e1433f085c8a77b9
Author: mrproliu <[email protected]>
AuthorDate: Mon Jun 17 15:27:29 2024 +0000

    Fix concurrent map operation in the access log module (#131)
---
 CHANGES.md                         | 1 +
 pkg/accesslog/common/connection.go | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3c1fa83..44b268c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -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
 
diff --git a/pkg/accesslog/common/connection.go 
b/pkg/accesslog/common/connection.go
index 159128d..e339a02 100644
--- a/pkg/accesslog/common/connection.go
+++ b/pkg/accesslog/common/connection.go
@@ -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 {
@@ -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)

Reply via email to