<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p><br>
</p>
Tatsuo,</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
I'm struggling to reproduce the problem, but can you please take a look at the attached&nbsp;pgpool log.</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
The log clearly says that PARSE message and BIND&nbsp;(B) messages were sent to the&nbsp;backend 0.</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<i><br>
</i></div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
1)&nbsp;The request was identified in Postgres and strace says it&nbsp;waits 'epoll_wait(3':</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">[root@OAA-a01149b7a559 ~]# sudo -i -u postgres psql --port=15432</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">psql (9.6.2)</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">Type &quot;help&quot; for help.</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><br>
</i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">postgres=# select * from pg_stat_activity where pid = 29108;</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">&nbsp;datid | datname | &nbsp;pid &nbsp;| usesysid | usename | application_name | client_addr | client_hostname | client_port | &nbsp; &nbsp; &nbsp; &nbsp; backend_start &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xact_start &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;query_start &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; &nbsp; &nbsp; state_change
 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">| wait_event_type | wait_event | state &nbsp;| backend_xid | backend_xmin | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;query &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">-------&#43;---------&#43;-------&#43;----------&#43;---------&#43;------------------&#43;-------------&#43;-----------------&#43;-------------&#43;-------------------------------&#43;-------------------------------&#43;-------------------------------&#43;------------------------------</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">&#43;-----------------&#43;------------&#43;--------&#43;-------------&#43;--------------&#43;------------------------------------------------------------------------------------------------------------------------------------------------------------------</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">&nbsp;16389 | oss &nbsp; &nbsp; | 29108 | &nbsp; &nbsp;16390 | oss &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 127.0.0.1 &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; 37570 | 2017-04-06 11:33:37.428804&#43;03 | 2017-04-06 11:34:03.018548&#43;03 | 2017-04-06 11:34:03.018738&#43;03 | 2017-04-06 11:34:03.01874&#43;03&nbsp;</span></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| active | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;1835366 | &nbsp;</span><b><span style="color: rgb(255, 0, 0); font-size: 11pt;">SELECT 1 FROM ui_locked_users WHERE &nbsp;LOWER(username) = LOWER( $1 ) AND &nbsp;(device_tag IS
 NULL OR device_tag = &nbsp;$2 ) AND &nbsp;(unlock_on IS NULL OR unlock_on &gt;= &nbsp;$3 )</span></b></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<i><span style="font-size: 11pt;">(1 row)</span></i></div>
<div><i><br>
</i></div>
2) The DB application stuck on the execution of SELECT query. &nbsp;It was blocked until the corresponding&nbsp;pgpool process was killed.</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
3) Pgpool log is attached.</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
Is it possible that pgpool didn't forward EXECUTE command to postgres? The problem is reproduced reliably if balancing is enabled, but I'm failing to reproduce it in a standalone test so far.</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
Sergey.</div>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Tatsuo Ishii &lt;ishii@sraoss.co.jp&gt;<br>
<b>Sent:</b> Thursday, April 6, 2017 3:48 AM<br>
<b>To:</b> Sergey Kim<br>
<b>Cc:</b> Boris Voskanov; pgpool-hackers@pgpool.net<br>
<b>Subject:</b> Re: [pgpool-hackers: 2227] Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created</font>
<div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">&gt; Tatsuo,<br>
&gt; <br>
&gt; <br>
&gt; the symptoms of the &quot;hanged&quot; pgpool are following:<br>
&gt; 1) DB applications fail with 2 types of errors:<br>
&gt;&nbsp;&nbsp; - failed to prepare statement (PARSE)<br>
&gt;&nbsp;&nbsp; - failed to extract ResultSet - failed selects<br>
&gt; <br>
&gt; 2) The problem is reproduced within a single JDBC connection, series of transactions are passed into it before the problem appears.<br>
&gt; <br>
&gt; I'm deeply analysed pgpool logs from the series of failures and revealed a sample case (i.e. pgpool process). It's logs are attached.<br>
&gt; I'm not sure I'm right but it seems the balancing logic is broken it its sequence of messages - how the are processed. I'am triggered by the fact it was sending PARSE messages to the both backends.<br>
<br>
Please provide a reproducable test case. I do not see any error<br>
message in the log.<br>
<br>
&gt; P/S: I was trying to attach the debugger to pgpool but I'm failed to detect a piece of code which I should focus at. Also it is a little bit hard to detect a pgpool process which should be debugged.<br>
<br>
Use ps to find a pgpool process which shows 'idle' state. Or you could<br>
set num_init_children to 1. In this case there's only one pgpool child<br>
process.<br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" id="LPlnk826684" previewremoved="true">
http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:http://www.sraoss.co.jp<br>
<br>
&gt; Sergey.<br>
&gt; ________________________________<br>
&gt; From: Sergey Kim<br>
&gt; Sent: Wednesday, April 5, 2017 1:48 PM<br>
&gt; To: Tatsuo Ishii<br>
&gt; Cc: Boris Voskanov; pgpool-hackers@pgpool.net; Sergey Onuchin<br>
&gt; Subject: Re: [pgpool-hackers: 2227] Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created<br>
&gt; <br>
&gt; <br>
&gt; ... also it happens only when balancing is enabled in pgpool.<br>
&gt; <br>
&gt; <br>
&gt; ________________________________<br>
&gt; From: Sergey Kim<br>
&gt; Sent: Wednesday, April 5, 2017 1:34:45 PM<br>
&gt; To: Tatsuo Ishii<br>
&gt; Cc: Boris Voskanov; pgpool-hackers@pgpool.net; Sergey Onuchin<br>
&gt; Subject: Re: [pgpool-hackers: 2227] Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created<br>
&gt; <br>
&gt; <br>
&gt; Tatsuo,<br>
&gt; <br>
&gt; <br>
&gt; the 2nd day of tests revealed a problem in pgpool which I trying to reproduce in a standalone test.<br>
&gt; <br>
&gt; <br>
&gt; Sometimes PARSE messages hang in pgpool and DB clients hang due to this reason. I'm just wanted to notify you on the problem. I'm fighting to reproduce it artificially.<br>
&gt; <br>
&gt; <br>
&gt; Sergey.<br>
&gt; <br>
&gt; <br>
&gt; ...the primary message was cut<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>