From ffd632140153c0c529f42ee4215aa11aec5ba36c Mon Sep 17 00:00:00 2001 From: joshjennings98 Date: Wed, 30 Jul 2025 09:53:55 +0100 Subject: [PATCH] :bug: `proc` In process find, ignore processes that have stopped between listing and matching --- changes/20250730095330.bugfix | 1 + utils/proc/find/find_linux.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changes/20250730095330.bugfix diff --git a/changes/20250730095330.bugfix b/changes/20250730095330.bugfix new file mode 100644 index 0000000000..1f8c8bcf96 --- /dev/null +++ b/changes/20250730095330.bugfix @@ -0,0 +1 @@ +:bug: `proc` In process find, ignore processes that have stopped between listing and matching diff --git a/utils/proc/find/find_linux.go b/utils/proc/find/find_linux.go index 23667a9ef7..8490f8b589 100644 --- a/utils/proc/find/find_linux.go +++ b/utils/proc/find/find_linux.go @@ -29,9 +29,9 @@ func checkProcessMatch(ctx context.Context, fs filesystem.FS, re *regexp.Regexp, data, err := fs.ReadFile(procEntry) if err != nil { - if commonerrors.CorrespondTo(err, "no bytes were read") { + if commonerrors.CorrespondTo(err, "no bytes were read", "no such file or directory") { err = nil - return // ignore special descriptors since our cmdline will have content (we still have to check since all files in proc have size zero) + return // ignore special descriptors since our cmdline will have content (we still have to check since all files in proc have size zero) as well as processes that have stopped since the listing occurred } err = commonerrors.WrapErrorf(commonerrors.ErrUnexpected, err, "could not read proc entry '%v'", procEntry) return