Skip to content

Commit 3f94cd7

Browse files
authored
Merge pull request #45 from github/znull/rss-process-missing
ignore errProcessInfoMissing when getting process RSS
2 parents f248bbb + e281877 commit 3f94cd7

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

internal/ptree/ptree.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ var (
2424
func GetProcessRSSAnon(pid int) (uint64, error) {
2525
status := fmt.Sprintf("%d/status", pid)
2626
f, err := procfs.Open(status)
27+
if os.IsNotExist(err) {
28+
// process is already gone
29+
return 0, nil
30+
}
2731
if err != nil {
2832
return 0, err
2933
}

pipe/memorylimit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func killAtLimit(byteLimit uint64, eventHandler func(e *Event)) memoryWatchFunc
5858
return
5959
case <-t.C:
6060
rss, err := stage.GetRSSAnon(ctx)
61-
if err != nil {
61+
if err != nil && !errors.Is(err, errProcessInfoMissing) {
6262
consecutiveErrors++
6363
if consecutiveErrors >= 2 {
6464
eventHandler(&Event{

0 commit comments

Comments
 (0)