pgpool2.git / summary / log / commit / refs

commit    a1e50c7d628ecf511e389d000b7d11f2db79e32d
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Thu Aug 13 13:39:19 2009 +0000

    Block signals before forking children rather after.
    Otherwise parent will be killed by failover signal if it receives
    before establish signal handler. See [pgpool-general-jp: 586] for
    more details.


main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 9da321966..0de8ad938 100644 --- a/main.c +++ b/main.c @@ -428,6 +428,14 @@ int main(int argc, char **argv) } *InRecovery = 0; + /* + * We need to block signal here. Otherwise child might send some + * signals, for example SIGUSR1(fail over). Children will inherit + * signal blocking but they do unblock signals at the very beginning + * of process. So this is harmless. + */ + POOL_SETMASK(&BlockSig); + /* fork the children */ for (i=0;i<pool_config->num_init_children;i++) { @@ -436,7 +444,7 @@ int main(int argc, char **argv) } /* set up signal handlers */ - POOL_SETMASK(&BlockSig); + pool_signal(SIGTERM, exit_handler); pool_signal(SIGINT, exit_handler); pool_signal(SIGQUIT, exit_handler); [parent: 4927b3ff3750]