Help Center/ Document Database Service/ Troubleshooting/ Connection Failure Message: Timeout while receiving message
Updated on 2022-12-07 GMT+08:00

Connection Failure Message: Timeout while receiving message

Symptom

An error is reported when a Java driver is used to connect to a DDS instance. The error information is as follows:

org.springframework.data.mongodb.UncategorizedMongoDbException: Timeout while receiving message; nested exception is com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message

Possible Cause

  • Slow queries occupy instance resources, causing the CPU usage to increase sharply or even reach the peak value.
  • The connection pool of the application is incorrectly configured. As a result, the number of connections increases sharply and reaches the maximum number of connections supported by the DDS instance.

Fault Locating

  • Check whether slow queries occupy instance resources.
  • Check whether the configuration of the application connection pool is correct.

Solution

  • Check whether slow queries exist. You can add indexes to optimize queries.
  • Check whether the client uses the connection pool properly.
  • Change the maximum number of connections supported by a DDS instance.

Background Information

The maximum number of connections depends on the instance specifications. When the maximum number of clients connected to an instance is reached, new client connection requests will be rejected.