<div dir="ltr">Hello,<div><br></div><div>I have a docker swarm architecture of 2 PostgreSQL nodes in Repmgr and a connection pooling method, pgool.<br></div><div><br></div><div><div>PostgreSQL Version: 12.4<br></div><div>PgPool Version: 4.2.5<br></div><div>Cluster-Management of Database: Repmgr (1 Primary + 1 Standby)</div><div><br></div><div><b>Issue:</b> There was constant increase in CPU Usage by postgresql container. On checking docker stats of postgresql primary node, it is consuming 328%. On normal days, it is below 50%.<br></div><div>On investigation, I found one query whose running time was around 20 hours and its state was idle in transaction.</div><div><br></div><div>Resolution: To control the CPU Usage, I terminated the pid in database using below query:</div><div>> 

SELECT pg_terminate_backend(4037086);


</div><div><br></div><div>But immediately after the pid was killed. The pgpool container  was shut down.</div><div><br></div><div><u>Pgpool-II Logs</u>:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2024-06-21 12:25:05: pid 809743: LOG:  reading and processing packets,<br>2024-06-21 12:25:05: pid 809743: DETAIL:  postmaster on DB node 0 was shutdown by administrative command,<br>2024-06-21 12:25:05: pid 809743: LOG:  received degenerate backend request for node_id: 0 from pid [809743],<br>2024-06-21 12:25:05: pid 809743: LOG:  signal_user1_to_parent_with_reason(0),<br>2024-06-21 12:25:05: pid 1: LOG:  Pgpool-II parent process received SIGUSR1,<br>2024-06-21 12:25:05: pid 1: LOG:  Pgpool-II parent process has received failover request,<br>2024-06-21 12:25:05: pid 1: LOG:  starting degeneration. shutdown host pg-0(5432),<br>2024-06-21 12:25:05: pid 1: LOG:  Restart all children,<br>2024-06-21 12:25:06: pid 1: LOG:  execute command: echo ">>> Failover - that will initialize new primary node search!",<br>>>> Failover - that will initialize new primary node search!<br></blockquote><div><br></div><div><u>PostgreSQL Logs</u>:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2024-06-21 12:25:05.992 GMT [4037086] FATAL:  terminating connection due to administrator command<br>2024-06-21 12:25:06.218 GMT [15488] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.287 GMT [15653] LOG:  could not receive data from client: Connection reset by peer<br>2024-06-21 12:25:06.288 GMT [15653] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.351 GMT [13183] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.355 GMT [14050] LOG:  could not receive data from client: Connection reset by peer<br>2024-06-21 12:25:06.355 GMT [14050] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.356 GMT [13189] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.357 GMT [15155] LOG:  could not receive data from client: Connection reset by peer<br>2024-06-21 12:25:06.357 GMT [15155] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.361 GMT [14736] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.362 GMT [15193] LOG:  could not receive data from client: Connection reset by peer<br>2024-06-21 12:25:06.370 GMT [15193] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.409 GMT [14504] LOG:  unexpected EOF on client connection with an open transaction<br>2024-06-21 12:25:06.444 GMT [13380] LOG:  unexpected EOF on client connection with an open transaction<br></blockquote><div><br></div><div>In pgpool logs, it is mentioned that the postmaster was shut down by administrative command. But I specifically mentioned the pid of the query whose state was idle in transaction.</div><div><br></div><div>Please help me understand what caused pgpool to shut down.</div><div><br></div><div><br></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b><u><font color="#4c1130">Thanks & Regards</font></u></b><div>Aviral Singh</div><div>Contact No: 8765789951 </div></div></div></div></div>