Help Center> Relational Database Service> Troubleshooting> RDS for MySQL> Connection Issues> Connection Exit Due to Improper Timeout Parameter Settings
Updated on 2023-03-06 GMT+08:00

Connection Exit Due to Improper Timeout Parameter Settings

Scenario

There are frequent database connection exits. As a result, subsequent statements fail to be executed.

Possible Causes

When a connector or API is used to connect to a database, the client has some default parameter settings. The settings of some important parameters, such as socketTimeout and connectTimeout, determine the client connection timeout duration. If the wait time of a connection exceeds the value of one of these parameters, the connection will be interrupted.

Solution

  • Change the default values of parameters such as socketTimeout and connectTimeout to appropriate values.
  • Pay attention to the reconnection function in the program.
  • Using connection pools is recommended.