pgpool2.git / summary / log / commit / refs

commit    c9bdf03e0d87e9bfc92c9cac3ddec3cefaa0d08b
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Sat Dec 06 14:04:13 2014 +0000

    Fix ill signal befavior of SIGCHLD in exec_ifconfig().
    
    For some reason signal(SIGCHLD, SIG_IGN) was set *and* tries to wait
    child process which always fails because SIGCHLD is never
    delivered. Due to this "ifconfig up" fails when switching to watchdog
    master. Fix is, before calling fork(), do "signal(SIGCHLD,
    SIG_DFL)". See "[pgpool-general: 3310] Watchdog - ifconfig up failed."
    for more details.


src/watchdog/wd_if.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/watchdog/wd_if.c b/src/watchdog/wd_if.c index 8d3dc2314..278c8be50 100644 --- a/src/watchdog/wd_if.c +++ b/src/watchdog/wd_if.c @@ -6,7 +6,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Copyright (c) 2003-2013 PgPool Global Development Group + * Copyright (c) 2003-2014 PgPool Global Development Group * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby @@ -223,6 +223,8 @@ exec_ifconfig(char * path,char * command) } args[i++] = NULL; + signal(SIGCHLD, SIG_DFL); + pid = fork(); if (pid == 0) { @@ -248,6 +250,8 @@ exec_ifconfig(char * path,char * command) ereport(DEBUG1, (errmsg("watchdog exec wait()failed"), errdetail("wait() system call failed with reason \"%s\"", strerror(errno)))); + + signal(SIGCHLD, SIG_IGN); return WD_NG; } @@ -257,6 +261,7 @@ exec_ifconfig(char * path,char * command) (errmsg("watchdog exec ifconfig failed"), errdetail("'%s' failed. exit status: %d",command, WEXITSTATUS(status)))); + signal(SIGCHLD, SIG_IGN); return WD_NG; } else @@ -267,6 +272,7 @@ exec_ifconfig(char * path,char * command) ereport(DEBUG1, (errmsg("watchdog exec ifconfig: '%s' succeeded", command))); + signal(SIGCHLD, SIG_IGN); return WD_OK; } [parent: 12bf2f7231fe]