pgpool2.git / summary / log / commit / refs
commit 873e2f2eaf2a213924a8417ffd4adf6661c750ad
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Wed Dec 28 08:37:11 2016 +0000
Fix authentication timeout that can occur right after client connecttions
This is possible when connection_life_time is enabled.
SIGALRM signal is used for both connection_life_time and
authentication_timeout. Usually, SIGALRM is for connection_life_time,
but when the new connection is arrive, read_startup_packet() is called,
and the handler for authentication_timeout is set by pool_signal() and
alarm(authentication_timeout) is called in enable_authentication_timeout().
However, if connection_life_time is expired **between pool_signal() and
alarm()**, authenticate_timeout() will be called when connection_life_time
is expired instead of pool_backend_timer_handler().
To fix this, call alarm() before pool_signal() to prevent the signal
handler from being with wrong timing.
src/protocol/child.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/protocol/child.c b/src/protocol/child.c
index 843db9281..db5872339 100644
--- a/src/protocol/child.c
+++ b/src/protocol/child.c
@@ -1034,8 +1034,8 @@ static void enable_authentication_timeout(void)
{
if(pool_config->authentication_timeout <= 0)
return;
- pool_signal(SIGALRM, authentication_timeout);
alarm(pool_config->authentication_timeout);
+ pool_signal(SIGALRM, authentication_timeout);
alarm_enabled = true;
}
[parent: a418eea8ca8f]