From cb4937a3ee6db20e6c269fe8cbb82f55ab47da74 Mon Sep 17 00:00:00 2001 From: Jason Lunz Date: Sat, 14 Feb 2026 15:30:22 +0100 Subject: [PATCH 1/3] ignore errProcessInfoMissing when getting process RSS --- pipe/memorylimit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipe/memorylimit.go b/pipe/memorylimit.go index f21ee15..d739569 100644 --- a/pipe/memorylimit.go +++ b/pipe/memorylimit.go @@ -58,7 +58,7 @@ func killAtLimit(byteLimit uint64, eventHandler func(e *Event)) memoryWatchFunc return case <-t.C: rss, err := stage.GetRSSAnon(ctx) - if err != nil { + if err != nil && err != errProcessInfoMissing { consecutiveErrors++ if consecutiveErrors >= 2 { eventHandler(&Event{ From fdfb660e012635a899fe7efa3f941ce24f254ee1 Mon Sep 17 00:00:00 2001 From: Jason Lunz Date: Sat, 14 Feb 2026 15:51:47 +0100 Subject: [PATCH 2/3] don't fail getting RSS if process has already exited --- internal/ptree/ptree.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/ptree/ptree.go b/internal/ptree/ptree.go index 1f53a20..494a104 100644 --- a/internal/ptree/ptree.go +++ b/internal/ptree/ptree.go @@ -24,6 +24,10 @@ var ( func GetProcessRSSAnon(pid int) (uint64, error) { status := fmt.Sprintf("%d/status", pid) f, err := procfs.Open(status) + if os.IsNotExist(err) { + // process is already gone + return 0, nil + } if err != nil { return 0, err } From e2818771bbae63763c0a8a4a7ee40ed5f9bda121 Mon Sep 17 00:00:00 2001 From: Jason Lunz Date: Sat, 14 Feb 2026 15:57:53 +0100 Subject: [PATCH 3/3] use errors.Is --- pipe/memorylimit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipe/memorylimit.go b/pipe/memorylimit.go index d739569..358a6de 100644 --- a/pipe/memorylimit.go +++ b/pipe/memorylimit.go @@ -58,7 +58,7 @@ func killAtLimit(byteLimit uint64, eventHandler func(e *Event)) memoryWatchFunc return case <-t.C: rss, err := stage.GetRSSAnon(ctx) - if err != nil && err != errProcessInfoMissing { + if err != nil && !errors.Is(err, errProcessInfoMissing) { consecutiveErrors++ if consecutiveErrors >= 2 { eventHandler(&Event{