pgpool2.git / summary / log / commit / refs

commit    e6d960686cd1cdeb03594a3785259c0cf5c2a016
Author:   Muhammad Usama <m.usama@gmail.com>
Date:     Wed Jan 04 13:23:33 2017 +0000

    Fix for 0000249: watchdog sometimes fails de-escalation.
    
    The logic in pgpool-II main process exit_handler and terminate_all_childrens was
    not making sure that pgpool-II main process should only exit after all its
    children have exited. And the problem occurs when the main process shutdowns
    itself before watchdog and de-escalation child processes.
    
    The solution is to use the waitpid() system call without WNOHANG option.


src/main/pgpool_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 56d58d053..f633bba5e 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -1076,7 +1076,7 @@ static void terminate_all_childrens() { int ret_pid; - wpid = waitpid(-1, &ret_pid, WNOHANG); + wpid = waitpid(-1, &ret_pid, 0); } while (wpid > 0 || (wpid == -1 && errno == EINTR)); if (wpid == -1 && errno != ECHILD) @@ -1449,7 +1449,7 @@ static RETSIGTYPE exit_handler(int sig) { int ret_pid; - wpid = waitpid(-1, &ret_pid, WNOHANG); + wpid = waitpid(-1, &ret_pid, 0); } while (wpid > 0 || (wpid == -1 && errno == EINTR)); if (wpid == -1 && errno != ECHILD) [parent: b50642d538dc]