<div dir="ltr">It might be that the connections were idle for too long and got killed by pgpool ?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 19, 2023 at 4:28 PM Bo Peng <<a href="mailto:pengbo@sraoss.co.jp">pengbo@sraoss.co.jp</a>> 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>
If the connection between Pgpool and PostgreSQL was unexpectedly closed<br>
or the backend process was terminated abnormally,<br>
the error "ERROR:  unable to read data from DB node" occurs.<br>
<br>
According to the details of the messages "Connection reset by peer" and "Broken Pipe",<br>
I think they may be caused by network problems or settings.<br>
<br>
If it is possible, could you check if these error occur<br>
when your application connects to PostgreSQL directly.<br>
<br>
Best regards,<br>
<br>
On Mon, 19 Jun 2023 12:18:08 +0530<br>
Aviral Singh <<a href="mailto:aviral.singh21@gmail.com" target="_blank">aviral.singh21@gmail.com</a>> wrote:<br>
<br>
> Hello,<br>
> <br>
> Let's say, a Java application is trying to read data from Database and for<br>
> that it establishes a connection through PgPool-II. Not all but a few<br>
> queries are throwing warning/error like "Connection reset by peer" or<br>
> "Broken Pipe" or "Unable to flush data to backend" in pgpool.<br>
> <br>
> OS Version: Ubuntu 22.04.1 LTS<br>
> PostgreSQL Version: 13.8<br>
> PgPool Version: 4.2.5<br>
> Cluster-Management of Database: Patroni-ETCD(1 Leader + 2 Replica Nodes)<br>
> <br>
> I am mentioning logs for your reference for all three services, *modules*(which<br>
> are connecting to the database)/*pgpool*/*database* which are extracted at<br>
> the same time.<br>
> <br>
> *Application Logs:*<br>
> 2023-06-15 09:56:41.014 [app-name] [app-name] [WARN ] [scheduler-3]<br>
> [PoolBase.java]isConnectionAlive(184) : timescaledb - Failed to validate<br>
> connection org.postgresql.jdbc.PgConnection@623dcf4c (This connection has<br>
> been closed.). Possibly consider using a shorter maxLifetime value.<br>
> 2023-06-15 09:56:41.017 [app-name] [app-name] [WARN ] [scheduler-3]<br>
> [PoolBase.java]isConnectionAlive(184) : timescaledb - Failed to validate<br>
> connection org.postgresql.jdbc.PgConnection@359610bd (This connection has<br>
> been closed.). Possibly consider using a shorter maxLifetime value.<br>
> 2023-06-15 09:56:41.019 [app-name] [app-name] [WARN ] [scheduler-3]<br>
> [PoolBase.java]isConnectionAlive(184) : timescaledb - Failed to validate<br>
> connection org.postgresql.jdbc.PgConnection@7ba2704e (This connection has<br>
> been closed.). Possibly consider using a shorter maxLifetime value.<br>
> 2023-06-15 09:56:41.020 [app-name] [app-name] [WARN ] [scheduler-3]<br>
> [PoolBase.java]isConnectionAlive(184) : timescaledb - Failed to validate<br>
> connection org.postgresql.jdbc.PgConnection@77e997d9 (This connection has<br>
> been closed.). Possibly consider using a shorter maxLifetime value.<br>
> 2023-06-15 09:56:41.021 [app-name] [app-name] [WARN ] [scheduler-3]<br>
> [PoolBase.java]isConnectionAlive(184) : timescaledb - Failed to validate<br>
> connection org.postgresql.jdbc.PgConnection@6dddd55d (This connection has<br>
> been closed.). Possibly consider using a shorter maxLifetime value.<br>
> 2023-06-15 09:56:41.023 [app-name] [app-name] [WARN ] [scheduler-3]<br>
> [PoolBase.java]isConnectionAlive(184) : timescaledb - Failed to validate<br>
> connection org.postgresql.jdbc.PgConnection@684b33a3 (This connection has<br>
> been closed.). Possibly consider using a shorter maxLifetime value.<br>
> <br>
> *PgPool Logs:*<br>
> 2023-06-15 09:56:41: pid 32465: WARNING:  write on backend 1 failed with<br>
> error :"Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 32465: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 32465: ERROR:  unable to flush data to backend<br>
> 2023-06-15 09:56:41: pid 32465: DETAIL:  do not failover because<br>
> failover_on_backend_error is off<br>
> 2023-06-15 09:56:41: pid 32465: WARNING:  write on backend 1 failed with<br>
> error :"Broken pipe"<br>
> 2023-06-15 09:56:41: pid 32465: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 34920: ERROR:  unable to read data from DB node 2<br>
> 2023-06-15 09:56:41: pid 34920: DETAIL:  socket read failed with error<br>
> "Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 34920: WARNING:  write on backend 2 failed with<br>
> error :"Broken pipe"<br>
> 2023-06-15 09:56:41: pid 34920: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 34494: ERROR:  unable to read data from DB node 0<br>
> 2023-06-15 09:56:41: pid 34494: DETAIL:  socket read failed with error<br>
> "Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 34494: WARNING:  write on backend 0 failed with<br>
> error :"Broken pipe"<br>
> 2023-06-15 09:56:41: pid 34494: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 34494: WARNING:  write on backend 2 failed with<br>
> error :"Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 34494: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 32948: ERROR:  unable to read data from DB node 0<br>
> 2023-06-15 09:56:41: pid 32948: DETAIL:  socket read failed with error<br>
> "Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 32948: WARNING:  write on backend 0 failed with<br>
> error :"Broken pipe"<br>
> 2023-06-15 09:56:41: pid 32948: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 32948: WARNING:  write on backend 2 failed with<br>
> error :"Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 32948: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 34985: ERROR:  unable to read data from DB node 0<br>
> 2023-06-15 09:56:41: pid 34985: DETAIL:  socket read failed with error<br>
> "Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 34985: WARNING:  write on backend 0 failed with<br>
> error :"Broken pipe"<br>
> 2023-06-15 09:56:41: pid 34985: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> 2023-06-15 09:56:41: pid 34875: ERROR:  unable to read data from DB node 2<br>
> 2023-06-15 09:56:41: pid 34875: DETAIL:  socket read failed with error<br>
> "Connection reset by peer"<br>
> 2023-06-15 09:56:41: pid 34875: WARNING:  write on backend 2 failed with<br>
> error :"Broken pipe"<br>
> 2023-06-15 09:56:41: pid 34875: DETAIL:  while trying to write data from<br>
> offset: 0 wlen: 5<br>
> <br>
> *PostgreSQL Logs:*<br>
> 2023-06-15 09:27:57  [PID-1]: [SessionID_1-1]<br>
> [unknown]@[unknown],app=[unknown] [00000] LOG:  connection received:<br>
> host=[ip-address] port=[port_no]<br>
> 2023-06-15 09:27:57  [PID-1]: [SessionID_1-2] db-name@user-name,app=[unknown]<br>
> [00000] LOG:  connection authorized: user=user-name database=db-name<br>
> 2023-06-15 09:56:41  [PID-1]: [SessionID_1-3] db-name@user-name,app=PostgreSQL<br>
> JDBC Driver [08006] LOG:  could not send data to client: Connection reset<br>
> by peer<br>
> 2023-06-15 09:56:41  [PID-1]: [SessionID_1-4] db-name@user-name,app=PostgreSQL<br>
> JDBC Driver [08006] FATAL:  connection to client lost<br>
> 2023-06-15 09:56:41  [PID-1]: [SessionID_1-5] db-name@user-name,app=PostgreSQL<br>
> JDBC Driver [00000] LOG:  disconnection: session time: 0:28:43.104<br>
> user=user-name database=db-name host=[ip-address] port=[port_no]<br>
> <br>
> <br>
> Seeing the Application Logs, I assumed that reducing the value of<br>
> maxLifetime in Hikari Pool will fix everything. But I tried to *read data<br>
> through DBeaver also*, but still got the same issue. So I guess this issue<br>
> is related to the Pgpool-II or PostgreSQL side.<br>
> <br>
> Along with not being able to identify why this is happening, I am also<br>
> unable to identify in pgpool logs why it is reading from replica nodes as I<br>
> have disabled the Load Balancing in PgPool configuration.<br>
> <br>
> Can you please help me with this? Is it an issue or is it a bug? If you can<br>
> help me with this then that will be very helpful. If not then can you<br>
> please suggest to me any forum where I can discuss the solution.<br>
> -- <br>
> *Thanks & Regards*<br>
> Aviral Singh<br>
> Contact No: 8765789951<br>
<br>
<br>
-- <br>
Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>><br>
SRA OSS LLC<br>
TEL: 03-5979-2701 FAX: 03-5979-2702<br>
URL: <a href="https://www.sraoss.co.jp/" rel="noreferrer" target="_blank">https://www.sraoss.co.jp/</a><br>
_______________________________________________<br>
pgpool-general mailing list<br>
<a href="mailto:pgpool-general@pgpool.net" target="_blank">pgpool-general@pgpool.net</a><br>
<a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
</blockquote></div>