Avoid exit/fork storm of pool_worker_child process.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 21 Apr 2019 06:57:22 +0000 (15:57 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 21 Apr 2019 07:11:36 +0000 (16:11 +0900)
commitb58aef839ac09e05184eac8d27d3e116b6d7c5aa
treeda6b7f21176182f597245144a5f558fd6bb40463
parent233673c9dd9c5d4a7dc62466369e3e18c2c945f9
Avoid exit/fork storm of pool_worker_child process.

pool_worker_child issues query to get WAL position using do_query(),
which could throws FATAL error. In this case pool_worker_child process
exits and Pgpool-II parent immediately forks new process. This cycle
indefinitely repeats and gives high load to the system.

This could easily happen. For example if ALWAYS_MASTER flag is
mistakenly set to standby node, it will cause an error:

ERROR:  recovery is in progress
HINT:  WAL control functions cannot be executed during recovery.
STATEMENT:  SELECT pg_current_wal_lsn()

To avoid the exit/fork storm, sleep sr_check_period.
src/protocol/pool_process_query.c