Java Driver Fails to Connect to the DB Instance, Leaving Message "Timeout while receiving message"
Symptom
An error is reported when you run the following command to connect to a DDS DB instance through Java driver:
Error message:
org.springframework.data.mongodb.UncategorizedMongoDbException: Timeout while receiving message; nested exception is com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message
Possible Cause
- Abnormal slow queries occupy DB instance resources, causing the CPU usage to increase sharply or even reach the peak value.
- The connection pool of the application is incorrectly configured. For example, the timeout interval is incorrectly set.
Solution
- Check whether slow queries exist. You are advised to add indexes for optimization.
- Check whether the connection pool of the application is correctly configured. For details, see How Do I Query and Limit the Number of Connections?
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.