<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace">Any idea why pgpool doesn&#39;t retry?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 17, 2019 at 6:19 PM Bo Peng &lt;<a href="mailto:pengbo@sraoss.co.jp">pengbo@sraoss.co.jp</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I confirmed your pgpool.conf, you set <br>
<br>
  health_check_max_retries = 16<br>
<br>
So I think the following result is correct. <br>
<br>
&gt; &gt;&gt; &gt; psql -c &#39;pgpool show health_check_max_retries&#39;<br>
&gt; &gt;&gt; &gt; health_check_max_retries<br>
&gt; &gt;&gt; &gt; --------------------------<br>
&gt; &gt;&gt; &gt; 16<br>
&gt; &gt;&gt; &gt; (1 row)<br>
<br>
On Fri, 15 Feb 2019 07:12:56 -0500<br>
Alexander Dorogensky &lt;<a href="mailto:amazinglifetime@gmail.com" target="_blank">amazinglifetime@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hi,<br>
&gt; <br>
&gt; Do you have any ideas what’s going on?<br>
&gt; <br>
&gt; On Mon, Feb 11, 2019 at 8:30 PM Alexander Dorogensky &lt;<br>
&gt; <a href="mailto:amazinglifetime@gmail.com" target="_blank">amazinglifetime@gmail.com</a>&gt; wrote:<br>
&gt; <br>
&gt; &gt; Pgpool.conf from one of the app nodes is attached<br>
&gt; &gt;<br>
&gt; &gt; Thanks<br>
&gt; &gt;<br>
&gt; &gt; On Mon, Feb 11, 2019 at 6:59 PM Bo Peng &lt;<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; Hi,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; On Mon, 11 Feb 2019 15:32:55 -0600<br>
&gt; &gt;&gt; Alexander Dorogensky &lt;<a href="mailto:amazinglifetime@gmail.com" target="_blank">amazinglifetime@gmail.com</a>&gt; wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; &gt; I&#39;m running 4 app (pgpool) nodes (3.6.10) and 2 db (postgres) nodes<br>
&gt; &gt;&gt; (9.6.9)<br>
&gt; &gt;&gt; &gt; primary/standby configuration with streaming replication. All 6 nodes<br>
&gt; &gt;&gt; are<br>
&gt; &gt;&gt; &gt; separate machines.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; A client has had too many failovers caused by the flaky network and in<br>
&gt; &gt;&gt; an<br>
&gt; &gt;&gt; &gt; effort to remedy the issue I set the following parameters<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; health_check_max_retries = 7<br>
&gt; &gt;&gt; &gt; health_check_retry_delay = 15<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; Now, I have the client&#39;s environment and a lab environment to reproduce<br>
&gt; &gt;&gt; the<br>
&gt; &gt;&gt; &gt; issue. Pgpool configuration and the version are identical.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; To simulate a flaky network, I use iptables to deny postgres<br>
&gt; &gt;&gt; connections to<br>
&gt; &gt;&gt; &gt; one of the db nodes and see that pgpool on all app nodes is trying to<br>
&gt; &gt;&gt; &gt; reconnect according to the configured number of retries and retry delay,<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; i.e.<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:22:51: pid 7825: LOG:  failed to connect to PostgreSQL<br>
&gt; &gt;&gt; &gt; &gt; server on &quot;<a href="http://10.0.10.133:5433" rel="noreferrer" target="_blank">10.0.10.133:5433</a>&quot;, getsockopt() detected error &quot;No route<br>
&gt; &gt;&gt; to<br>
&gt; &gt;&gt; &gt; &gt; host&quot;<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:23:23: pid 6458: LOG:  health checking retry count 1<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:23:38: pid 6458: LOG:  health checking retry count 2<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:42:45: pid 6458: LOG:  health checking retry count 3<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:43:00: pid 6458: LOG:  health checking retry count 4<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:43:15: pid 6458: LOG:  health checking retry count 5<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:43:30: pid 6458: LOG:  health checking retry count 6<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:43:30: pid 6460: LOG:  failover request from local<br>
&gt; &gt;&gt; pgpool-II<br>
&gt; &gt;&gt; &gt; &gt; node received on IPC interface is forwarded to master watchdog node &quot;<br>
&gt; &gt;&gt; &gt; &gt; <a href="http://172.20.20.173:5432" rel="noreferrer" target="_blank">172.20.20.173:5432</a>&quot;<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:43:30: pid 4565: LOG:  watchdog received the failover<br>
&gt; &gt;&gt; &gt; &gt; command from remote pgpool-II node &quot;<a href="http://172.20.20.172:5432" rel="noreferrer" target="_blank">172.20.20.172:5432</a>&quot;<br>
&gt; &gt;&gt; &gt; &gt; ...<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-11 14:43:30: pid 4563: LOG:  execute command:<br>
&gt; &gt;&gt; &gt; &gt; /etc/pgpool-II/failover.sh 0 10.0.10.133 5433 /opt/redsky/db/data 1 0<br>
&gt; &gt;&gt; &gt; &gt; 10.0.10.134 1 5433 /opt/redsky/db/data<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; However, in the client&#39;s environment failover gets initiated before<br>
&gt; &gt;&gt; the<br>
&gt; &gt;&gt; &gt; configured number of retries, i.e.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  watchdog received the failover<br>
&gt; &gt;&gt; &gt; &gt; command from local pgpool-II on IPC interface<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  watchdog is processing the<br>
&gt; &gt;&gt; failover<br>
&gt; &gt;&gt; &gt; &gt; command [DEGENERATE_BACKEND_REQUEST] received from local pgpool-II on<br>
&gt; &gt;&gt; IPC<br>
&gt; &gt;&gt; &gt; &gt; interface<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  forwarding the failover request<br>
&gt; &gt;&gt; &gt; &gt; [DEGENERATE_BACKEND_REQUEST] to all alive nodes<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: DETAIL:  watchdog cluster currently<br>
&gt; &gt;&gt; has 3<br>
&gt; &gt;&gt; &gt; &gt; connected remote nodes<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19276: ERROR:  unable to read data from DB<br>
&gt; &gt;&gt; node 1<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19276: DETAIL:  socket read failed with an<br>
&gt; &gt;&gt; error<br>
&gt; &gt;&gt; &gt; &gt; &quot;Success&quot;<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19400: LOG:  Pgpool-II parent process has<br>
&gt; &gt;&gt; &gt; &gt; received failover request<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  new IPC connection received<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  received the failover command<br>
&gt; &gt;&gt; lock<br>
&gt; &gt;&gt; &gt; &gt; request from local pgpool-II on IPC interface<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  local pgpool-II node &quot;<br>
&gt; &gt;&gt; &gt; &gt; <a href="http://10.15.35.35:5432" rel="noreferrer" target="_blank">10.15.35.35:5432</a>&quot; is requesting to become a lock holder for failover<br>
&gt; &gt;&gt; ID:<br>
&gt; &gt;&gt; &gt; &gt; 19880<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19402: LOG:  local pgpool-II node &quot;<br>
&gt; &gt;&gt; &gt; &gt; <a href="http://10.15.35.35:5432" rel="noreferrer" target="_blank">10.15.35.35:5432</a>&quot; is the lock holder<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19400: LOG:  starting degeneration. shutdown<br>
&gt; &gt;&gt; host<br>
&gt; &gt;&gt; &gt; &gt; 10.38.135.137(5433)<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19400: LOG:  Restart all children<br>
&gt; &gt;&gt; &gt; &gt; 2019-02-09 05:17:47: pid 19400: LOG:  execute command:<br>
&gt; &gt;&gt; &gt; &gt; /etc/pgpool-II/failover.sh 1 10.38.135.137 5433 /opt/redsky/db/data 0<br>
&gt; &gt;&gt; 0<br>
&gt; &gt;&gt; &gt; &gt; 10.15.35.39 1 5433 /opt/redsky/db/data<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; I ran the following command on all app nodes<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; psql -c &#39;pgpool show health_check_max_retries&#39;<br>
&gt; &gt;&gt; &gt; health_check_max_retries<br>
&gt; &gt;&gt; &gt; --------------------------<br>
&gt; &gt;&gt; &gt; 16<br>
&gt; &gt;&gt; &gt; (1 row)<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; and the number is different from what I have in the configuration file..<br>
&gt; &gt;&gt; &gt; It&#39;s more than 1 though and I expect it to be honored.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; I could not reproduce this issue by using pgpool_setup.<br>
&gt; &gt;&gt; Could you share the whole pgpool.conf?<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; &gt; Can you guys help me out? I&#39;m out of ideas..<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; pgpool-II-pg96-3.6.10-1pgdg.rhel6.x86_64<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; --<br>
&gt; &gt;&gt; Bo Peng &lt;<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>&gt;<br>
&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
<br>
<br>
-- <br>
Bo Peng &lt;<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>&gt;<br>
SRA OSS, Inc. Japan<br>
<br>
</blockquote></div>