Skip to content

Commit

Permalink
cgroup,cleaner: wait on level-triggered transitions
Browse files Browse the repository at this point in the history
The old code used edge-triggered transitions for epoll_wait on the
cgroup.events file, which meant we were losing some events if we weren't
fast enough to process them. This, in turn, caused the unlucky cleaner
processes to hang on an epoll_wait, unable to clean up the unpopulated
cgroup.

With this commit, we now operate on level-triggered transitions, which
allows cleaners to do their jobs properly.
  • Loading branch information
Snaipe committed Feb 6, 2024
1 parent b351478 commit 949b3fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static void run_cleaner_child(int lock, int parentfd, const char *name)
}

struct epoll_event event = {
.events = EPOLLET,
.events = 0,
};

int epollfd = epoll_create1(0);
Expand Down Expand Up @@ -192,8 +192,7 @@ static void run_cleaner_child(int lock, int parentfd, const char *name)
for (;;) {
int ready = epoll_wait(epollfd, &event, 1, -1);
if (ready == -1 && errno != EINTR) {
warn("run_cgroup_child: epoll_wait cgroup.events");
goto recursiveClean;
err(1, "run_cgroup_child: epoll_wait cgroup.events");
}

rewind(eventsfp);
Expand Down

0 comments on commit 949b3fc

Please sign in to comment.