Date: Sun, 03 Oct 2010 15:45:47 +0300 From: Mikolaj Golub <to.my.trociny@gmail.com> To: freebsd-fs@freebsd.org Cc: Pawel Jakub Dawidek <pjd@FreeBSD.org> Subject: hastd: zombies after hooks Message-ID: <86hbh3igw4.fsf@kopusha.home.net>
next in thread | raw e-mail | index | archive | help
--=-=-= Hi, After recent changes hastd does not garbage collect finished hooks leaving zombies and messages in log like below: Oct 3 18:21:05 bolek hastd[5144]: Hook is running for 1330 seconds (pid=5223, cmd=[/usr/bin/true connect storage]). This is because wait3() in hook_check() is never called (we never call hook_check(true)). Below is a patch that works for me. -- Mikolaj Golub --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=hook_check.patch Index: sbin/hastd/hastd.c =================================================================== --- sbin/hastd/hastd.c (revision 213380) +++ sbin/hastd/hastd.c (working copy) @@ -659,7 +659,7 @@ main_loop(void) assert(maxfd + 1 <= (int)FD_SETSIZE); ret = select(maxfd + 1, &rfds, NULL, NULL, &seltimeout); if (ret == 0) - hook_check(false); + hook_check(); else if (ret == -1) { if (errno == EINTR) continue; Index: sbin/hastd/hooks.c =================================================================== --- sbin/hastd/hooks.c (revision 213380) +++ sbin/hastd/hooks.c (working copy) @@ -293,7 +293,7 @@ hook_check_one(pid_t pid, int status) } void -hook_check(bool sigchld) +hook_check(void) { struct hookproc *hp, *hp2; int status; @@ -303,12 +303,10 @@ void assert(hooks_initialized); /* - * If SIGCHLD was received, garbage collect finished processes. + * Garbage collect finished processes. */ - if (sigchld) { - while ((pid = wait3(&status, WNOHANG, NULL)) > 0) - hook_check_one(pid, status); - } + while ((pid = wait3(&status, WNOHANG, NULL)) > 0) + hook_check_one(pid, status); /* * Report about processes that are running for a long time. Index: sbin/hastd/hooks.h =================================================================== --- sbin/hastd/hooks.h (revision 213380) +++ sbin/hastd/hooks.h (working copy) @@ -41,7 +41,7 @@ void hook_init(void); void hook_fini(void); void hook_check_one(pid_t pid, int status); -void hook_check(bool sigchld); +void hook_check(void); void hook_exec(const char *path, ...); void hook_execv(const char *path, va_list ap); --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86hbh3igw4.fsf>