pgpool2.git / summary / log / commit / refs

commit    fa6c3aa3233fd984a8b717f59e26b2ab9b7c8383
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed Jun 26 09:17:11 2013 +0000

    Fix pgpool -m f stop" hang.
    
    This is caused by unmanaged pgpool children remaining.  This could
    happen if multiple PostgreSQL are going down (or even starting pgpool,
    without starting PostgreSQL can easily trigger this).  Child calls
    degenerate_backend_set() and it tries to aquire semaphore to write a
    failover request. In this case the signal mask is set as well, thus
    signals are never received. To fix this, kill pgpool children before
    forking them.


main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.c b/main.c index 7914b71d8..b3c806085 100644 --- a/main.c +++ b/main.c @@ -2081,6 +2081,19 @@ static void failover(void) { for (i=0;i<pool_config->num_init_children;i++) { + + /* + * Try to kill pgpool child because previous kill signal + * may not be received by pgpool child. This could happen + * if multiple PostgreSQL are going down (or even starting + * pgpool, without starting PostgreSQL can trigger this). + * Child calls degenerate_backend() and it tries to aquire + * semaphore to write a failover request. In this case + * also the signal mask is set, thus signals are never + * received. + */ + kill(process_info[i].pid, SIGQUIT); + process_info[i].pid = fork_a_child(unix_fd, inet_fd, i); process_info[i].start_time = time(NULL); } [parent: 7804e0fbc1fb]