Fix connection_life_time not working when serialize_accept is enabled.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 1 Sep 2020 03:21:50 +0000 (12:21 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 1 Sep 2020 03:21:50 +0000 (12:21 +0900)
commitf8b63be8862cd54c0f3a9b13da9602928aaf330d
tree401adcd15c29aacd1c7a876ff06235ac81526c96
parent9c8ea012051e50fcf26de477905629619a8d0e39
Fix connection_life_time not working when serialize_accept is enabled.

If serialize_accept is enabled, pgpool child process tries to acquire
semaphore locking so that there's only one process which can issue
accept(2). Unfortunately if connection_life_time is enabled, an alarm
is set right before the semaphore locking. So when the alarm fires,
nothing happened because the process was in acquiring semaphore lock
loop by using pool_semaphore_lock().

To fix this new pool_semaphore_lock_allow_interrupt() is introduced,
which immediately returns if interrupted by a signal. The caller:
wait_for_new_connections() checks whether connection_life_time alarm
is fired. If so, call backend_timer() to close expired backend
connection cache.

Discussion: https://www.pgpool.net/pipermail/pgpool-general/2020-August/007233.html
src/include/utils/pool_ipc.h
src/protocol/child.c
src/protocol/pool_connection_pool.c
src/utils/pool_sema.c