org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.

Symptoms
org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:350)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:236)
at PostgreSqlExample.main(PostgreSqlExample.java:15)
........................
........................
Cause
Client connection got dropped before the query execution completed by PostgreSQL Server. Below are some of the major reasons for this.
- Socket timeout set at the application (driver) level
- Connection dropped due to issues at network/firewall
Solution
- Check the timeout parameters configured in the application, below is an example where the socket timeout is set for 10 seconds.
jdbc:postgresql://192.168.2.3:5432/postgres?socketTimeout=10&ssl=true&sslmode=prefer
- Check the firewall/network related settings