<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>Tatsuo, </p>
<p><br>
</p>
<p>this time all previously created tests succeeded but out application failed to start. So we started searching for the problem and could reproduce "balanced select problem". The test can run for minutes before reproduction of the problem (((</p>
<p>I'm not sure if it can help but please pay attention that time lag between insert is select requests is very small. <span style="font-size: 12pt;"></span></p>
<p><br>
</p>
<p>Please see the pgpool logs:</p>
<p></p>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.889485+03:00 OAA-54999c4d7735 pgpool[25595]: [79-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 0 backend pid: 25885 statement: B message</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.889702+03:00 OAA-54999c4d7735 pgpool[25595]: [79-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.889924+03:00 OAA-54999c4d7735 pgpool[25595]: [80-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 1 backend pid: 27691 statement: B message</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.890090+03:00 OAA-54999c4d7735 pgpool[25595]: [80-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.890248+03:00 OAA-54999c4d7735 pgpool[25595]: [81-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 0 backend pid: 25885 statement: Execute: BEGIN</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.890378+03:00 OAA-54999c4d7735 pgpool[25595]: [81-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.890535+03:00 OAA-54999c4d7735 pgpool[25595]: [82-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 1 backend pid: 27691 statement: Execute: BEGIN</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.890693+03:00 OAA-54999c4d7735 pgpool[25595]: [82-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.890863+03:00 OAA-54999c4d7735 pgpool[25595]: [83-1] 2017-03-14 16:06:37: pid 25595:LOG:
</span><b><span style="color: rgb(255, 0, 0); font-size: 10pt;"> DB node id: 0 backend pid: 25885 statement: Parse: insert into write_table(id) values($1)</span></b></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.891144+03:00 OAA-54999c4d7735 pgpool[25595]: [83-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.891390+03:00 OAA-54999c4d7735 pgpool[25595]: [84-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 0 backend pid: 25885 statement: B message</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.891637+03:00 OAA-54999c4d7735 pgpool[25595]: [84-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.891895+03:00 OAA-54999c4d7735 pgpool[25595]: [85-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 0 backend pid: 25885 statement: D message</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.892091+03:00 OAA-54999c4d7735 pgpool[25595]: [85-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.892272+03:00 OAA-54999c4d7735 pgpool[25595]: [86-1] 2017-03-14 16:06:37: pid 25595:LOG: </span><b><span style="color: rgb(255, 0, 0); font-size: 10pt;">DB node id: 0 backend pid: 25885 statement: Execute:
insert into write_table(id) values($1)</span></b></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.892442+03:00 OAA-54999c4d7735 pgpool[25595]: [86-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.892642+03:00 OAA-54999c4d7735 pgpool[25595]: [87-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 1 backend pid: 27691 statement: B message</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.892828+03:00 OAA-54999c4d7735 pgpool[25595]: [87-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.892998+03:00 OAA-54999c4d7735 pgpool[25595]: [88-1] 2017-03-14 16:06:37: pid 25595:LOG: </span><b><span style="color: rgb(255, 0, 0); font-size: 10pt;">DB node id: 1 backend pid: 27691 statement: Execute:
select id from write_table where id = $1</span></b></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.893187+03:00 OAA-54999c4d7735 pgpool[25595]: [88-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.893359+03:00 OAA-54999c4d7735 pgpool[25595]: [89-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 1 backend pid: 27691 statement: ABORT</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.893584+03:00 OAA-54999c4d7735 pgpool[25595]: [89-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.893839+03:00 OAA-54999c4d7735 pgpool[25595]: [90-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 0 backend pid: 25885 statement: ABORT</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.894039+03:00 OAA-54999c4d7735 pgpool[25595]: [90-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.894220+03:00 OAA-54999c4d7735 pgpool[25595]: [91-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 0 backend pid: 25885 statement: DISCARD ALL</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.894403+03:00 OAA-54999c4d7735 pgpool[25595]: [91-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.894587+03:00 OAA-54999c4d7735 pgpool[25595]: [92-1] 2017-03-14 16:06:37: pid 25595:LOG: DB node id: 1 backend pid: 27691 statement: DISCARD ALL</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.894753+03:00 OAA-54999c4d7735 pgpool[25595]: [92-2] 2017-03-14 16:06:37: pid 25595:LOCATION: pool_proto_modules.c:3208</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.894944+03:00 OAA-54999c4d7735 pgpool[25595]: [93-1] 2017-03-14 16:06:37: pid 25595:LOG: child exiting, 1 connections reached</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.895079+03:00 OAA-54999c4d7735 pgpool[25595]: [93-2] 2017-03-14 16:06:37: pid 25595:LOCATION: child.c:406</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.895371+03:00 OAA-54999c4d7735 pgpool[25566]: [47-1] 2017-03-14 16:06:37: pid 25566:LOG: child process with pid: 25595 exits with status 256</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.895635+03:00 OAA-54999c4d7735 pgpool[25566]: [47-2] 2017-03-14 16:06:37: pid 25566:LOCATION: pgpool_main.c:2380</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.895943+03:00 OAA-54999c4d7735 pgpool[25566]: [48-1] 2017-03-14 16:06:37: pid 25566:LOG: fork a new child process with pid: 25887</span></div>
<div><span style="font-size: 10pt;">2017-03-14T16:06:37.896174+03:00 OAA-54999c4d7735 pgpool[25566]: [48-2] 2017-03-14 16:06:37: pid 25566:LOCATION: pgpool_main.c:2466</span></div>
<div><br>
</div>
<br>
<p></p>
And java client logs:</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div><span style="font-size: 10pt;">16:06:37.890 (2) simple execute, handler=org.postgresql.jdbc.PgStatement$StatementResultHandler@689604d9, maxRows=0, fetchSize=0, flags=1</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Parse(stmt=null,query="BEGIN",oids={})</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Bind(stmt=null,portal=null)</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Execute(portal=null,limit=0)</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Parse(stmt=null,query="insert into write_table(id) values($1)",oids={23})</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Bind(stmt=null,portal=null,$1=<-613120604>)</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Describe(portal=null)</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Execute(portal=null,limit=0)</span></div>
<div><span style="font-size: 10pt;">16:06:37.890 (2) FE=> Sync</span></div>
<div><span style="font-size: 10pt;">16:06:37.892 (2) <=BE ParseComplete [null]</span></div>
<div><span style="font-size: 10pt;">16:06:37.892 (2) <=BE BindComplete [unnamed]</span></div>
<div><span style="font-size: 10pt;">16:06:37.892 (2) <=BE CommandStatus(BEGIN)</span></div>
<div><span style="font-size: 10pt;">16:06:37.892 (2) <=BE ParseComplete [null]</span></div>
<div><span style="font-size: 10pt;">16:06:37.892 (2) <=BE BindComplete [unnamed]</span></div>
<div><span style="font-size: 10pt;">16:06:37.892 (2) <=BE NoData</span></div>
<div><b><span style="color: rgb(255, 0, 0); font-size: 10pt;">16:06:37.892 (2) <=BE CommandStatus(INSERT 0 1)</span></b></div>
<div><span style="font-size: 10pt;">16:06:37.893 (2) <=BE ReadyForQuery(T)</span></div>
<div><span style="font-size: 10pt;">16:06:37.893 (2) simple execute, handler=org.postgresql.jdbc.PgStatement$StatementResultHandler@18078bef, maxRows=0, fetchSize=0, flags=0</span></div>
<div><span style="font-size: 10pt;">16:06:37.893 (2) FE=> Bind(stmt=S_1,portal=null,$1=<-613120604>)</span></div>
<div><span style="font-size: 10pt;">16:06:37.893 (2) FE=> Execute(portal=null,limit=0)</span></div>
<div><span style="font-size: 10pt;">16:06:37.893 (2) FE=> Sync</span></div>
<div><span style="font-size: 10pt;">16:06:37.895 (2) <=BE BindComplete [unnamed]</span></div>
<div><b><span style="color: rgb(255, 0, 0); font-size: 10pt;">16:06:37.895 (2) <=BE CommandStatus(SELECT 0)</span></b></div>
<div><span style="font-size: 10pt;">16:06:37.895 (2) <=BE ReadyForQuery(T)</span></div>
<div><span style="font-size: 10pt;">16:06:37.895 (2) FE=> Terminate</span></div>
<div><span style="font-size: 10pt;">Exception in thread "main" java.lang.RuntimeException: Balanced</span></div>
<div><span class="Apple-tab-span" style="white-space: pre; font-size: 10pt;"></span><span style="font-size: 10pt;">at com.pgpool.tests.Issue271_SingleThread.runTest(Issue271_SingleThread.java:57)</span></div>
<div><span class="Apple-tab-span" style="white-space: pre; font-size: 10pt;"></span><span style="font-size: 10pt;">at com.pgpool.tests.TestStarter.main(TestStarter.java:37)</span></div>
<div><br>
</div>
<br>
</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
The java test 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">
P/S:</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
Pgpool was build from branch bug271:</div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div><i><span style="font-size: 10pt;">[root@OAA-54999c4d7735 pgpool2]# git log -2</span></i></div>
<div><i><span style="font-size: 10pt;">commit 0955a22fb7f30c5b9c1fabe2873c09246453ee50</span></i></div>
<div><i><span style="font-size: 10pt;">Author: Tatsuo Ishii <ishii@postgresql.org></span></i></div>
<div><i><span style="font-size: 10pt;">Date: Tue Mar 14 19:03:02 2017 +0900</span></i></div>
<div><i><br>
</i></div>
<div><i><span style="font-size: 10pt;"> Fix problem described in [pgpool-hackers: 2125].</span></i></div>
<div><i><span style="font-size: 10pt;"> </span></i></div>
<div><i><span style="font-size: 10pt;"> Two problems are fixed:</span></i></div>
<div><i><span style="font-size: 10pt;"> </span></i></div>
<div><i><span style="font-size: 10pt;"> - The writing_transaction flag is not reset at transaction</span></i></div>
<div><i><span style="font-size: 10pt;"> committed/aborted. Before it was done in CommandComplete but now it</span></i></div>
<div><i><span style="font-size: 10pt;"> is possible that we need to check the flag before a command complete</span></i></div>
<div><i><span style="font-size: 10pt;"> message arrives. So at Execute, it is taken care by</span></i></div>
<div><i><span style="font-size: 10pt;"> handle_query_context() which used to be a static function in</span></i></div>
<div><i><span style="font-size: 10pt;"> CommandComplete.c. Also the session context memory is always cleared</span></i></div>
<div><i><span style="font-size: 10pt;"> before start a session context.</span></i></div>
<div><i><span style="font-size: 10pt;"> </span></i></div>
<div><i><span style="font-size: 10pt;"> - Ready for query Re-sync code path in read_kind_from_backend did not</span></i></div>
<div><i><span style="font-size: 10pt;"> work. The pending message corresponding to the ready for query</span></i></div>
<div><i><span style="font-size: 10pt;"> message could be a sync message, which does not have query</span></i></div>
<div><i><span style="font-size: 10pt;"> context. But before we checked if there's a query context</span></i></div>
<div><i><span style="font-size: 10pt;"> exists. The check is bogus and removed.</span></i></div>
<div><i><br>
</i></div>
<div><i><span style="font-size: 10pt;">commit 7c955b2a2dfb77623055b5eae9afe041de3105ee</span></i></div>
<div><i><span style="font-size: 10pt;">Author: Tatsuo Ishii <ishii@postgresql.org></span></i></div>
<div><i><span style="font-size: 10pt;">Date: Sun Mar 12 10:19:34 2017 +0900</span></i></div>
<div><i><br>
</i></div>
<div><i><span style="font-size: 10pt;"> Downgrade 1 more ereport from LOG to DEBUG1.</span></i></div>
<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">
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div><span style="font-size: 10pt;">Sergey</span>
<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 <ishii@sraoss.co.jp><br>
<b>Sent:</b> Tuesday, March 14, 2017 1:28 PM<br>
<b>To:</b> Sergey Kim<br>
<b>Cc:</b> pgpool-hackers@pgpool.net<br>
<b>Subject:</b> Re: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi Sergey,<br>
<br>
I have created a new branch named "bug271" which has been used to<br>
develop the patch for bug 271 on private git repository. Now you could<br>
use either the email attached patches or the branch if it's<br>
convieninet for you. The branch was created against the master<br>
branch. I will occasionaly rebase it with the master branch. In the<br>
near future the branch will be merged into the master branch (and I<br>
plan to back-patch it to 3.6 stable tree).<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="LPlnk270346" previewremoved="true">
http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:http://www.sraoss.co.jp<br>
<br>
From: pgpool-committers-bounces@pgpool.net<br>
Subject: [pgpool-committers: 3836] pgpool: Branch refs/heads/bug271 was created<br>
Date: Tue, 14 Mar 2017 10:19:33 +0000<br>
Message-ID: <E1cnjYD-0005zz-GZ@gothos.postgresql.org><br>
<br>
> Branch refs/heads/bug271 was created.<br>
> <br>
> View: <a href="http://git.postgresql.org/gitweb?p=pgpool2.git;a=shortlog;h=refs/heads/bug271" id="LPlnk584703" previewremoved="true">
http://git.postgresql.org/gitweb?p=pgpool2.git;a=shortlog;h=refs/heads/bug271</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>