[PATCH] AlmaLinux 8: cronie 1.5.2-1.5.4 100% CPU usage bug
Hi All,
We areusing AlmaLinux 8 docker image for docker-compose and one of the services is cron (using cronie). We faced 100% CPU load issue. The problem is described here: https://bugzilla.redhat.com/show_bug.cgi?id=1723106
I see there is a patch (fixed in 1.5.5). Patch: https://github.com/cronie-crond/cronie/commit/584911514ce6aa2f16e1d79431bac8...
Also we found that cronie 1.5.2-10 is used in CentOS 8 Stream, probably with similar patch (didn't found the way to get src rpm), but still 1.5.2-8 in AlmaLinux. Thus, I backported the patch and ask to include it or fix using Centos stream one. Fixed src rpm: https://repo.codeit.guru/packages/unsigned/cronie-1.5.2-9.codeit.el8.src.rpm (see patch10 in spec).
Can you review this or point me where to send it?
Thanks.
Best regards, Alexander Gerasimov Chief Technical Officer CodeIT
Hi All,
I was able to download cronie patchlevel 10 from CentOS Stream and found 2 additional patches that are not included in AlmaLinux 8:
1) 0004-Fix-regression-in-handling-1-5-crontab-entries.patch
2) optimization_to_close_fds.patch (which is another approach to fix 100% CPU usage bug):
--- ./src/do_command.c 2023-09-07 09:40:32.016272074 +0200 +++ ./src/do_command.c 2023-09-07 09:43:04.938995232 +0200 @@ -30,6 +30,7 @@ #include <string.h> #include <sys/wait.h> #include <unistd.h> +#include <dirent.h>
#include "externs.h" #include "funcs.h" @@ -239,10 +240,26 @@ { char *shell = env_get("SHELL", jobenv); int fd, fdmax = getdtablesize(); + DIR *dir; + struct dirent *dent;
- /* close all unwanted open file descriptors */ - for(fd = STDERR + 1; fd < fdmax; fd++) { - close(fd); + /* + * if /proc is mounted, we can optimize what fd can be closed, + * but if it isn't available, fall back to the previous behavior. + */ + if ((dir = opendir("/proc/self/fd")) != NULL) { + while ((dent = readdir(dir)) != NULL) { + if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) + continue; + fd = atoi(dent->d_name); + if (fd > STDERR_FILENO) + close(fd); + } + } else { + /* close all unwanted open file descriptors */ + for(fd = STDERR + 1; fd < fdmax; fd++) { + close(fd); + } }
#if DEBUGGING
The problem is important, prevents from using cronjobs.
Nobody answers here and in the chat, no way to set up a ticket, patches from CentOS are not included. Is AlmaLinux supported at all?
Best regards, Alexander Gerasimov Chief Technical Officer CodeIT
participants (1)
-
Alexander Gerasimov