Help Center/ Relational Database Service/ Troubleshooting/ RDS for PostgreSQL/ Error Reported When a Request Is Executed Through an Existing Connection
Updated on 2024-10-24 GMT+08:00

Error Reported When a Request Is Executed Through an Existing Connection

Scenario

When a client executes a request through an existing connection, the following error information is displayed:

  • Error 1
    org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend. 
  • Error 2
    org.postgresql.util.PSQLException: The connection attempt failed 
    ... 
    Caused by: java.net.SocketException: Connection reset

Solution to Error 1

Possible causes:

  • There are too many parameters in the SQL statement.
  • The connection has been released.

Solution:

  • If there are too many parameters in the SQL statement, split the SQL statement.
  • If the connection has been released, check the client connection parameters, such as the connection timeout interval. Add an automatic retry mechanism for your client.

Solution to Error 2

This error is reported when a connection that has been released is used. The possible causes are as follows:

  • There are problems with network connectivity.
  • The instance is being rebooted or the backend process crashes.
  • Idle connections are released upon timeout.

Solution:

  1. Check the network connectivity and determine whether the disconnection is caused by network link factors (such as high packet loss rate and retransmission rate).
  2. If there are no network problems, check for other errors.
  3. If no, check the connection timeout parameters (such as sockettimeout and connecttimeout for the JDBC connection pool). If the values are too small, connections can be released automatically.