core/cgroup: Add OOM check

Check if process(es) of a cgroup were killed by Kernel OOM killer
or systemd-oomd before we send the cgroup empty notification.

This allows us to show the right exit state(ServiceResult)
This commit is contained in:
Nishal Kulkarni
2022-03-22 00:52:35 +05:30
parent f5d0f21c37
commit f7829525be
+4
View File
@@ -2958,6 +2958,10 @@ static int on_cgroup_empty_event(sd_event_source *s, void *userdata) {
log_debug_errno(r, "Failed to reenable cgroup empty event source, ignoring: %m");
}
/* Update state based on OOM kills before we notify about cgroup empty event */
(void) unit_check_oom(u);
(void) unit_check_oomd_kill(u);
unit_add_to_gc_queue(u);
if (UNIT_VTABLE(u)->notify_cgroup_empty)