diff --git a/src/protocol/pool_connection_pool.c b/src/protocol/pool_connection_pool.c index 047c711..508686c 100644 --- a/src/protocol/pool_connection_pool.c +++ b/src/protocol/pool_connection_pool.c @@ -5,7 +5,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Copyright (c) 2003-2014 PgPool Global Development Group + * Copyright (c) 2003-2015 PgPool Global Development Group * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby @@ -672,16 +672,32 @@ static bool connect_with_timeout(int fd, struct addrinfo *walk, char *host, int } else /* select returns error */ { - if((errno == EINTR && retry) || errno == EAGAIN) + if ((errno == EINTR && retry) || errno == EAGAIN) { ereport(LOG, (errmsg("trying to connect to PostgreSQL server on \"%s:%d\" using INET socket",host,port), errdetail("select() interrupted. retrying..."))); continue; } + + /* + * select(2) was interrupted by certain signal and we guess it + * was not SIGALRM because health_check_timer_expired was not + * set (if the variable was set, we can assume that SIGALRM + * handler was called). Surely this is not a health check time + * out. We can assume that this is a transient case. So we + * will retry again... + */ + if (health_check_timer_expired == 0 && errno == EINTR) + { + ereport(LOG, + (errmsg("connect_inet_domain_socket: select() interrupted by certain signal. retrying..."))); + continue; + } + ereport(LOG, (errmsg("failed to connect to PostgreSQL server on \"%s:%d\" using INET socket",host,port), - errdetail("select() system call interrupted"))); + errdetail("select() system call failed with an error \"%s\"",strerror(errno)))); close(fd); return false; }