mongoDB timeout issue from Java Client

Hi Guys,

Looking for MongoDB’s help with the issue we are facing
Issue: MongoDB instance connection timeout issue with instance unavailable message in the log file when MongoDB primary instance goes into lock status while backup

Note : We are not able to replicate the issue from the dev instance with the same Mongo client configuration and we are able to read the data from the DB instance from Intellij Idea Database Pane.

Error from the tomcat log:

Mar 15, 2023, 2:06:35 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/ws] threw exception [Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Timeout waiting for a pooled item after 30000 MILLISECONDS; nested exception is com.mongodb.MongoTimeoutException: Timeout waiting for a pooled item after 30000 MILLISECONDS] with root cause
com.mongodb.MongoTimeoutException: Timeout waiting for a pooled item after 30000 MILLISECONDS

MongoDB Client configuration :

<mongo:mongo-client credentials="${ddi.mongo.app.user}:${ddi.mongo.app.password}@${ddi.mongo.app.authenticationDatabase}" id="mongoClient" replica-set="${ddi.mongo.app.machine.one}:${ddi.mongo.app.port},${ddi.mongo.app.machine.two}:${ddi.mongo.app.port},${ddi.mongo.app.machine.three}:${ddi.mongo.app.port}">
    <mongo:client-options connections-per-host="5"
                          threads-allowed-to-block-for-connection-multiplier="10"
                          connect-timeout="100000"
                          max-wait-time="30000"
                          socket-keep-alive="true"
                          socket-timeout="1000000"
                          write-concern="NORMAL"
                          read-preference="PRIMARY_PREFERRED"/>
</mongo:mongo-client>

Hi @Prasad_Basutkar and welcome to MongoDB community forums!!

I see that your post hasn’t been addressed yet.
Are you still facing the issue with the system?

Based on the above statement, I understand that you are using the fsync process on the primary member of the replica set?
Although using fsyncLock() is one method to perform a backup, it’s disruptive to the server’s operation since all writes are forbidden while the server is in this state.

If you wish to backup a replica set configuration, you could follow the steps mentioned in the documentation Restore a Replica Set from MongoDB Backups.

Regards
Aasawari