Verify a process passed by pid_file exists (#5768)
This commit is contained in:
parent
2fb62d4aec
commit
cb4387df3f
|
@ -295,6 +295,10 @@ func (p *Procstat) updateProcesses(pids []PID, tags map[string]string, prevInfo
|
||||||
for _, pid := range pids {
|
for _, pid := range pids {
|
||||||
info, ok := prevInfo[pid]
|
info, ok := prevInfo[pid]
|
||||||
if ok {
|
if ok {
|
||||||
|
// Assumption: if a process has no name, it probably does not exist
|
||||||
|
if name, _ := info.Name(); name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
procs[pid] = info
|
procs[pid] = info
|
||||||
} else {
|
} else {
|
||||||
proc, err := p.createProcess(pid)
|
proc, err := p.createProcess(pid)
|
||||||
|
@ -302,6 +306,10 @@ func (p *Procstat) updateProcesses(pids []PID, tags map[string]string, prevInfo
|
||||||
// No problem; process may have ended after we found it
|
// No problem; process may have ended after we found it
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Assumption: if a process has no name, it probably does not exist
|
||||||
|
if name, _ := proc.Name(); name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
procs[pid] = proc
|
procs[pid] = proc
|
||||||
|
|
||||||
// Add initial tags
|
// Add initial tags
|
||||||
|
|
Loading…
Reference in New Issue