Skip to content

Commit df729d2

Browse files
authored
Merge pull request #621 from jnovy/620
Check memory.events file exists before adding inotify watch
2 parents 9952ef5 + d436a96 commit df729d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cgroup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ static void setup_oom_handling_cgroup_v2(int pid)
124124
}
125125

126126
if (inotify_add_watch(ifd, memory_events_file_path, IN_MODIFY) < 0) {
127-
nwarnf("Failed to add inotify watch for %s", memory_events_file_path);
127+
if (errno == ENOENT) {
128+
ndebugf("memory.events file does not exist at %s, skipping OOM monitoring", memory_events_file_path);
129+
} else {
130+
nwarnf("Failed to add inotify watch for %s", memory_events_file_path);
131+
}
128132
return;
129133
}
130134

0 commit comments

Comments
 (0)