Skip to content

Commit

Permalink
processmanager: Fix process exit regression (#337)
Browse files Browse the repository at this point in the history
This fixes an issue introduced with dd4c52b.
  • Loading branch information
christos68k committed Feb 3, 2025
1 parent 6e527d6 commit 7f3bafe
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions processmanager/processinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,22 +525,27 @@ func (pm *ProcessManager) processPIDExit(pid libpf.PID) {
pm.mu.Lock()
defer pm.mu.Unlock()

pidExitProcessed := false
info, pidExists := pm.pidToProcessInfo[pid]
if !pidExists {
log.Debugf("Skip process exit handling for unknown PID %d", pid)
return
}
if pm.interpreterTracerEnabled && len(pm.interpreters[pid]) > 0 {
if pidExists || (pm.interpreterTracerEnabled &&
len(pm.interpreters[pid]) > 0) {
// ProcessPIDExit may be called multiple times in short succession
// for the same PID, don't update exitKTime if we've previously recorded it.
if _, pidExitProcessed := pm.exitEvents[pid]; !pidExitProcessed {
if _, pidExitProcessed = pm.exitEvents[pid]; !pidExitProcessed {
pm.exitEvents[pid] = exitKTime
} else {
log.Debugf("Skip duplicate process exit handling for PID %d", pid)
return
}
}

if !pidExists {
log.Debugf("Skip process exit handling for unknown PID %d", pid)
return
}

if pidExitProcessed {
log.Debugf("Skip duplicate process exit handling for PID %d", pid)
return
}

// Delete all entries we have for this particular PID from pid_page_to_mapping_info.
deleted, err2 := pm.ebpf.DeletePidPageMappingInfo(pid, []lpm.Prefix{dummyPrefix})
if err2 != nil {
Expand Down

0 comments on commit 7f3bafe

Please sign in to comment.