Help Center/ GaussDB(for MySQL)/ Troubleshooting/ Parameter-related Issues/ Connection Exit Due to Improper Timeout Parameter Settings
Updated on 2023-10-19 GMT+08:00

Connection Exit Due to Improper Timeout Parameter Settings

Scenario

A database connection exit often occurs. 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.