Yes and that behaviour which you describe as expected, is not what we want. We want pgpool to degrade backend0 and failover when configured max health check retries have failed, and to failover only in that case, so not sooner e.g. connection/child error condition, but as soon as max health check retries have been attempted.<br>
<br>Maybe examples will be more clear.<br><br>Imagine two nodes (node 1 and node 2). On each node a single pgpool and a single backend. Apps/clients access db through pgpool on their own node.<br>Two backends are configured in postgres native streaming replication. pgpools are used in raw mode. Both pgpools have same backend as backend0, and same backend as backend1.<br>
initial state: both backends are up and pgpool can access them, clients connect to their pgpool and do their work on master backend, backend0.<br><br>1st case: unmodified/non-patched pgpool 3.1.1 is used, backends are configured with ALLOW_TO_FAILOVER flag<br>
- temporary network outage happens between pgpool on node 2 and backend0<br>- error condition is reported by child process, and since ALLOW_TO_FAILOVER is set, pgpool performs failover without giving chance to pgpool health check retries to control whether backend is just temporarily inaccessible<br>
- failover command on node 2 promotes standby backend to a new master - split brain occurs, with two masters<br><br><br>2nd case: unmodified/non-patched pgpool 3.1.1 is used, backends are configured with DISALLOW_TO_FAILOVER<br>
- temporary network outage happens between pgpool on node 2 and backend0<br>- error condition is reported by child process, and since 
DISALLOW_TO_FAILOVER is set, pgpool does not perform failover<br>- health check gets a chance to check backend0 condition, determines that it&#39;s not accessible, there will be no health check retries because DISALLOW_TO_FAILOVER is set, no failover occurs ever<br>
<br><br>3rd case, pgpool 3.1.1 + patch you&#39;ve sent applied, and backends configured with DISALLOW_TO_FAILOVER<br>- temporary network outage happens between pgpool on node 2 and backend0<br>- error condition is reported by child process, and since 
DISALLOW_TO_FAILOVER is set, pgpool does not perform failover<br>- health check gets a chance to check backend0 condition, determines that 
it&#39;s not accessible, health check retries happen, and even after max 
retries, no failover happens since failover is disallowed<br>
<br><br>4th expected behaviour, pgpool 3.1.1 + patch we sent, and backends configured with DISALLOW_TO_FAILOVER<br>- temporary network outage happens between pgpool on node 2 and backend0<br>

- error condition is reported by child process, and since 
DISALLOW_TO_FAILOVER is set, pgpool does not perform failover<br>

- health check gets a chance to check backend0 condition, determines that 
it&#39;s not accessible, health check retries happen, before a max retry network condition is cleared, retry happens, and backend0 remains to be master, no failover occurs, temporary network issue did not cause split brain<br>
- after some time, temporary network outage happens again between pgpool on node 2 and backend0<br>- error condition is reported by child process, and since 
DISALLOW_TO_FAILOVER is set, pgpool does not perform failover<br>

- health check gets a chance to check backend0 condition, determines that 
it&#39;s not accessible, health check retries happen, after max 
retries backend0 is still not accessible, failover happens, standby is new master and backend0 is degraded<br>
<br>Kind regards,<br>Stevo.<br><br><div class="gmail_quote">2012/1/15 Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In my test evironment, the patch works as expected. I have two<br>
backends. Health check retry conf is as follows:<br>
<br>
health_check_max_retries = 3<br>
health_check_retry_delay = 1<br>
<br>
5 09:17:20 LOG:   pid 21411: Backend status file /home/t-ishii/work/<a href="http://git.postgresql.org/test/log/pgpool_status" target="_blank">git.postgresql.org/test/log/pgpool_status</a> discarded<br>
2012-01-15 09:17:20 LOG:   pid 21411: pgpool-II successfully started. version 3.2alpha1 (hatsuiboshi)<br>
2012-01-15 09:17:20 LOG:   pid 21411: find_primary_node: primary node id is 0<br>
-- backend1 was shutdown<br>
<br>
2012-01-15 09:17:50 ERROR: pid 21445: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:17:50 ERROR: pid 21445: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:17:50 ERROR: pid 21445: check_replication_time_lag: could not connect to DB node 1, check sr_check_user and sr_check_password<br>
2012-01-15 09:17:50 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:17:50 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:17:50 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:17:50 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
-- health check failed<br>
<br>
2012-01-15 09:17:50 ERROR: pid 21411: health check failed. 1 th host /tmp at port 11001 is down<br>
-- start retrying<br>
2012-01-15 09:17:50 LOG:   pid 21411: health check retry sleep time: 1 second(s)<br>
2012-01-15 09:17:51 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:17:51 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:17:51 ERROR: pid 21411: health check failed. 1 th host /tmp at port 11001 is down<br>
2012-01-15 09:17:51 LOG:   pid 21411: health check retry sleep time: 1 second(s)<br>
2012-01-15 09:17:52 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:17:52 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:17:52 ERROR: pid 21411: health check failed. 1 th host /tmp at port 11001 is down<br>
2012-01-15 09:17:52 LOG:   pid 21411: health check retry sleep time: 1 second(s)<br>
2012-01-15 09:17:53 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:17:53 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:17:53 ERROR: pid 21411: health check failed. 1 th host /tmp at port 11001 is down<br>
2012-01-15 09:17:53 LOG:   pid 21411: health_check: 1 failover is canceld because failover is disallowed<br>
-- after 3 retries, pgpool wanted to failover, but gave up because DISALLOW_TO_FAILOVER is set for backend1<br>
<br>
2012-01-15 09:18:00 ERROR: pid 21445: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:18:00 ERROR: pid 21445: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:18:00 ERROR: pid 21445: check_replication_time_lag: could not connect to DB node 1, check sr_check_user and sr_check_password<br>
2012-01-15 09:18:03 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:18:03 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:18:03 ERROR: pid 21411: health check failed. 1 th host /tmp at port 11001 is down<br>
2012-01-15 09:18:03 LOG:   pid 21411: health check retry sleep time: 1 second(s)<br>
2012-01-15 09:18:04 ERROR: pid 21411: connect_unix_domain_socket_by_port: connect() failed to /tmp/.s.PGSQL.11001: No such file or directory<br>
2012-01-15 09:18:04 ERROR: pid 21411: make_persistent_db_connection: connection to /tmp(11001) failed<br>
2012-01-15 09:18:04 ERROR: pid 21411: health check failed. 1 th host /tmp at port 11001 is down<br>
2012-01-15 09:18:04 LOG:   pid 21411: health check retry sleep time: 1 second(s)<br>
2012-01-15 09:18:05 LOG:   pid 21411: after some retrying backend returned to healthy state<br>
-- started backend1 and pgpool succeeded in health checking. Resumed using backend1<br>
<div class="HOEnZb"><div class="h5">--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Hello Tatsuo,<br>
&gt;<br>
&gt; Thank you for the patch and effort, but unfortunately this change won&#39;t<br>
&gt; work for us. We need to set disallow failover to prevent failover on child<br>
&gt; reported connection errors (it&#39;s ok if few clients lose their connection or<br>
&gt; can not connect), and still have pgpool perform failover but only on failed<br>
&gt; health check (if configured, after max retries threshold has been reached).<br>
&gt;<br>
&gt; Maybe it would be best to add an extra value for backend_flag -<br>
&gt; ALLOW_TO_FAILOVER_ON_HEALTH_CHECK or DISALLOW_TO_FAILOVER_ON_CHILD_ERROR.<br>
&gt; It should behave same as DISALLOW_TO_FAILOVER is set, with only difference<br>
&gt; in behaviour when health check (if set, max retries) has failed - unlike<br>
&gt; DISALLOW_TO_FAILOVER, this new flag should allow failover in this case only.<br>
&gt;<br>
&gt; Without this change health check (especially health check retries) doesn&#39;t<br>
&gt; make much sense - child error is more likely to occur on (temporary)<br>
&gt; backend failure then health check and will or will not cause failover to<br>
&gt; occur depending on backend flag, without giving health check retries a<br>
&gt; chance to determine if failure was temporary or not, risking split brain<br>
&gt; situation with two masters just because of temporary network link hiccup.<br>
&gt;<br>
&gt; Our main problem remains though with the health check timeout not being<br>
&gt; respected in these special conditions we have. Maybe Nenad can help you<br>
&gt; more to reproduce the issue on your environment.<br>
&gt;<br>
&gt; Kind regards,<br>
&gt; Stevo.<br>
&gt;<br>
&gt; 2012/1/13 Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;<br>
&gt;&gt; Thanks for pointing it out.<br>
&gt;&gt; Yes, checking DISALLOW_TO_FAILOVER before retrying is wrong.<br>
&gt;&gt; However, after retry count over, we should check DISALLOW_TO_FAILOVER I<br>
&gt;&gt; think.<br>
&gt;&gt; Attached is the patch attempt to fix it. Please try.<br>
&gt;&gt; --<br>
&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; pgpool is being used in raw mode - just for (health check based) failover<br>
&gt;&gt; &gt; part, so applications are not required to restart when standby gets<br>
&gt;&gt; &gt; promoted to new master. Here is pgpool.conf file and a very small patch<br>
&gt;&gt; &gt; we&#39;re using applied to pgpool 3.1.1 release.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; We have to have DISALLOW_TO_FAILOVER set for the backend since any child<br>
&gt;&gt; &gt; process that detects condition that master/backend0 is not available, if<br>
&gt;&gt; &gt; DISALLOW_TO_FAILOVER was not set, will degenerate backend without giving<br>
&gt;&gt; &gt; health check a chance to retry. We need health check with retries because<br>
&gt;&gt; &gt; condition that backend0 is not available could be temporary (network<br>
&gt;&gt; &gt; glitches to the remote site where master is, or deliberate failover of<br>
&gt;&gt; &gt; master postgres service from one node to the other on remote site - in<br>
&gt;&gt; both<br>
&gt;&gt; &gt; cases remote means remote to the pgpool that is going to perform health<br>
&gt;&gt; &gt; checks and ultimately the failover) and we don&#39;t want standby to be<br>
&gt;&gt; &gt; promoted as easily to a new master, to prevent temporary network<br>
&gt;&gt; conditions<br>
&gt;&gt; &gt; which could occur frequently to frequently cause split brain with two<br>
&gt;&gt; &gt; masters.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; But then, with DISALLOW_TO_FAILOVER set, without the patch health check<br>
&gt;&gt; &gt; will not retry and will thus give only one chance to backend (if health<br>
&gt;&gt; &gt; check ever occurs before child process failure to connect to the<br>
&gt;&gt; backend),<br>
&gt;&gt; &gt; rendering retry settings effectively to be ignored. That&#39;s where this<br>
&gt;&gt; patch<br>
&gt;&gt; &gt; comes into action - enables health check retries while child processes<br>
&gt;&gt; are<br>
&gt;&gt; &gt; prevented to degenerate backend.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I don&#39;t think, but I could be wrong, that this patch influences the<br>
&gt;&gt; &gt; behavior we&#39;re seeing with unwanted health check attempt delays. Also,<br>
&gt;&gt; &gt; knowing this, maybe pgpool could be patched or some other support be<br>
&gt;&gt; built<br>
&gt;&gt; &gt; into it to cover this use case.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2012/1/12 Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; I have accepted the moderation request. Your post should be sent<br>
&gt;&gt; shortly.<br>
&gt;&gt; &gt;&gt; Also I have raised the post size limit to 1MB.<br>
&gt;&gt; &gt;&gt; I will look into this...<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; Here is the log file and strace output file (this time in an archive,<br>
&gt;&gt; &gt;&gt; &gt; didn&#39;t know about 200KB constraint on post size which requires<br>
&gt;&gt; moderator<br>
&gt;&gt; &gt;&gt; &gt; approval). Timings configured are 30sec health check interval, 5sec<br>
&gt;&gt; &gt;&gt; &gt; timeout, and 2 retries with 10sec retry delay.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; It takes a lot more than 5sec from started health check to sleeping<br>
&gt;&gt; 10sec<br>
&gt;&gt; &gt;&gt; &gt; for first retry.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Seen in code (main.x, health_check() function), within (retry) attempt<br>
&gt;&gt; &gt;&gt; &gt; there is inner retry (first with postgres database then with<br>
&gt;&gt; template1)<br>
&gt;&gt; &gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt; that part doesn&#39;t seem to be interrupted by alarm.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; 2012/1/12 Stevo Slavić &lt;<a href="mailto:sslavic@gmail.com">sslavic@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Here is the log file and strace output file. Timings configured are<br>
&gt;&gt; &gt;&gt; 30sec<br>
&gt;&gt; &gt;&gt; &gt;&gt; health check interval, 5sec timeout, and 2 retries with 10sec retry<br>
&gt;&gt; &gt;&gt; delay.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; It takes a lot more than 5sec from started health check to sleeping<br>
&gt;&gt; &gt;&gt; 10sec<br>
&gt;&gt; &gt;&gt; &gt;&gt; for first retry.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Seen in code (main.x, health_check() function), within (retry)<br>
&gt;&gt; attempt<br>
&gt;&gt; &gt;&gt; &gt;&gt; there is inner retry (first with postgres database then with<br>
&gt;&gt; template1)<br>
&gt;&gt; &gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt;&gt; that part doesn&#39;t seem to be interrupted by alarm.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; 2012/1/11 Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Ok, I will do it. In the mean time you could use &quot;strace -tt -p PID&quot;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; to see which system call is blocked.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; OK, got the info - key point is that ip forwarding is disabled for<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; security<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; reasons. Rules in iptables are not important, iptables can be<br>
&gt;&gt; &gt;&gt; stopped,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; or<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; previously added rules removed.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; Here are the steps to reproduce (kudos to my colleague Nenad<br>
&gt;&gt; &gt;&gt; Bulatovic<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; for<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; providing this):<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 1.) make sure that ip forwarding is off:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;     echo 0 &gt; /proc/sys/net/ipv4/ip_forward<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2.) create IP alias on some interface (and have postgres listen on<br>
&gt;&gt; &gt;&gt; it):<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;     ip addr add x.x.x.x/yy dev ethz<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 3.) set backend_hostname0 to aforementioned IP<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 4.) start pgpool and monitor health checks<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 5.) remove IP alias:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;     ip addr del x.x.x.x/yy dev ethz<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; Here is the interesting part in pgpool log after this:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:38:04 DEBUG: pid 24358: starting health checking<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:38:04 DEBUG: pid 24358: health_check: 0 th DB node<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; status: 2<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:38:04 DEBUG: pid 24358: health_check: 1 th DB node<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; status: 1<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:38:34 DEBUG: pid 24358: starting health checking<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:38:34 DEBUG: pid 24358: health_check: 0 th DB node<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; status: 2<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:41:43 DEBUG: pid 24358: health_check: 0 th DB node<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; status: 2<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:41:46 ERROR: pid 24358: health check failed. 0 th<br>
&gt;&gt; host<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 192.168.2.27 at port 5432 is down<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; 2012-01-11 17:41:46 LOG:   pid 24358: health check retry sleep<br>
&gt;&gt; time:<br>
&gt;&gt; &gt;&gt; 10<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; second(s)<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; That pgpool was configured with health check interval of 30sec,<br>
&gt;&gt; 5sec<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; timeout, and 10sec retry delay with 2 max retries.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; Making use of libpq instead for connecting to db in health checks<br>
&gt;&gt; IMO<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; should resolve it, but you&#39;ll best determine which call exactly<br>
&gt;&gt; gets<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; blocked waiting. Btw, psql with PGCONNECT_TIMEOUT env var<br>
&gt;&gt; configured<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; respects that env var timeout.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt; On Wed, Jan 11, 2012 at 11:15 AM, Stevo Slavić &lt;<a href="mailto:sslavic@gmail.com">sslavic@gmail.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt; Tatsuo,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt; Did you restart iptables after adding rule?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt; On Wed, Jan 11, 2012 at 11:12 AM, Stevo Slavić &lt;<br>
&gt;&gt; <a href="mailto:sslavic@gmail.com">sslavic@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; Looking into this to verify if these are all necessary changes<br>
&gt;&gt; to<br>
&gt;&gt; &gt;&gt; have<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; port unreachable message silently rejected (suspecting some<br>
&gt;&gt; kernel<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; parameter tuning is needed).<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; Just to clarify it&#39;s not a problem that host is being detected<br>
&gt;&gt; by<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; pgpool<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; to be down, but the timing when that happens. On environment<br>
&gt;&gt; where<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; issue is<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; reproduced pgpool as part of health check attempt tries to<br>
&gt;&gt; connect<br>
&gt;&gt; &gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; backend and hangs for tcp timeout instead of being interrupted<br>
&gt;&gt; by<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; timeout<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; alarm. Can you verify/confirm please the health check retry<br>
&gt;&gt; timings<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; are not<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; delayed?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; On Wed, Jan 11, 2012 at 10:50 AM, Tatsuo Ishii &lt;<br>
&gt;&gt; &gt;&gt; <a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; Ok, I did:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; # iptables -A FORWARD -j REJECT --reject-with<br>
&gt;&gt; &gt;&gt; icmp-port-unreachable<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; on the host where pgpoo is running. And pull network cable from<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; backend0 host network interface. Pgpool detected the host being<br>
&gt;&gt; &gt;&gt; down<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; as expected...<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt; Backend is not destination of this message, pgpool host is,<br>
&gt;&gt; and<br>
&gt;&gt; &gt;&gt; we<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; don&#39;t<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt; want it to ever get it. With command I&#39;ve sent you rule will<br>
&gt;&gt; be<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; created for<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt; any source and destination.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt; On Wed, Jan 11, 2012 at 10:38 AM, Tatsuo Ishii &lt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; <a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; I did following:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; Do following on the host where pgpool is running on:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; # iptables -A FORWARD -j REJECT --reject-with<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; icmp-port-unreachable -d<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; 133.137.177.124<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; (133.137.177.124 is the host where backend is running on)<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; Pull network cable from backend0 host network interface.<br>
&gt;&gt; Pgpool<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; detected the host being down as expected. Am I missing<br>
&gt;&gt; &gt;&gt; something?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; Hello Tatsuo,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; With backend0 on one host just configure following rule on<br>
&gt;&gt; &gt;&gt; other<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; host<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; where<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; pgpool is:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; iptables -A FORWARD -j REJECT --reject-with<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; icmp-port-unreachable<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; and then have pgpool startup with health checking and<br>
&gt;&gt; &gt;&gt; retrying<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; configured,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; and then pull network cable from backend0 host network<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; interface.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt; On Wed, Jan 11, 2012 at 6:27 AM, Tatsuo Ishii &lt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; <a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; I want to try to test the situation you descrived:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; When system is configured for security reasons not<br>
&gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; return<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; destination<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; host unreachable messages, even though<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; health_check_timeout is<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; But I don&#39;t know how to do it. I pulled out the network<br>
&gt;&gt; &gt;&gt; cable<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; pgpool detected it as expected. Also I configured the<br>
&gt;&gt; server<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; which<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; PostgreSQL is running on to disable the 5432 port. In<br>
&gt;&gt; this<br>
&gt;&gt; &gt;&gt; case<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; connect(2) returned EHOSTUNREACH (No route to host) so<br>
&gt;&gt; &gt;&gt; pgpool<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; detected<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; the error as expected.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; Could you please instruct me?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Hello Tatsuo,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Thank you for replying!<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; I&#39;m not sure what exactly is blocking, just by pgpool<br>
&gt;&gt; code<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; analysis I<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; suspect it is the part where a connection is made to<br>
&gt;&gt; the<br>
&gt;&gt; &gt;&gt; db<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; it<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; doesn&#39;t<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; seem to get interrupted by alarm. Tested thoroughly<br>
&gt;&gt; health<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; check<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; behaviour,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; it works really well when host/ip is there and just<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; backend/postgres<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; is<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; down, but not when backend host/ip is down. I could<br>
&gt;&gt; see in<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; log<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; that<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; initial<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; health check and each retry got delayed when host/ip is<br>
&gt;&gt; &gt;&gt; not<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; reachable,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; while when just backend is not listening (is down) on<br>
&gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; reachable<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; host/ip<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; then initial health check and all retries are exact to<br>
&gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; settings in<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; pgpool.conf.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; PGCONNECT_TIMEOUT is listed as one of the libpq<br>
&gt;&gt; &gt;&gt; environment<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; variables<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; in<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; the docs (see<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; <a href="http://www.postgresql.org/docs/9.1/static/libpq-envars.html" target="_blank">http://www.postgresql.org/docs/9.1/static/libpq-envars.html</a>)<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; There is equivalent parameter in libpq<br>
&gt;&gt; PGconnectdbParams (<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; see<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; <a href="http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT" target="_blank">http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT</a><br>

&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; )<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; At the beginning of that same page there are some<br>
&gt;&gt; &gt;&gt; important<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; infos on<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; using<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; these functions.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; psql respects PGCONNECT_TIMEOUT.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; On Wed, Jan 11, 2012 at 12:13 AM, Tatsuo Ishii &lt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; <a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; Hello pgpool community,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; When system is configured for security reasons not<br>
&gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; return<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; destination<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; host unreachable messages, even though<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; health_check_timeout is<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; configured,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; socket call will block and alarm will not get raised<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; until TCP<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; timeout<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; occurs.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Interesting. So are you saying that read(2) cannot be<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; interrupted by<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; alarm signal if the system is configured not to return<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; destination<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; host unreachable message? Could you please guide me<br>
&gt;&gt; &gt;&gt; where I<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; can<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; get<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; such that info? (I&#39;m not a network expert).<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; Not a C programmer, found some info that select call<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; could be<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; replace<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; with<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; select/pselect calls. Maybe it would be best if<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; PGCONNECT_TIMEOUT<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; value<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; could be used here for connection timeout. pgpool<br>
&gt;&gt; has<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; libpq as<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; dependency,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; why isn&#39;t it using libpq for the healthcheck db<br>
&gt;&gt; connect<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; calls, then<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; PGCONNECT_TIMEOUT would be applied?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; I don&#39;t think libpq uses select/pselect for<br>
&gt;&gt; establishing<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; connection,<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; but using libpq instead of homebrew code seems to be<br>
&gt;&gt; an<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; idea.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; Let me<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; think about it.<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; One question. Are you sure that libpq can deal with<br>
&gt;&gt; the<br>
&gt;&gt; &gt;&gt; case<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; (not to<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; return destination host unreachable messages) by using<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; PGCONNECT_TIMEOUT?<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt;<br>
</div></div></blockquote></div><br>