[JAVA-2764] MongoTimeoutException: Timedout after 10000 ms while waiting for a server Created: 01/Feb/18  Updated: 07/Apr/23  Resolved: 01/Feb/18

Status: Closed
Project: Java Driver
Component/s: GridFS
Affects Version/s: 2.13.2
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: nycle chen Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: Bug, driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

java driver: 2.13.2
mongodb server version: 3.0.7
three nodes for Replica Set for GridFS.



 Description   

Envrionment: Three nodes for Replica Set, and used for GridFS.
One of the Secondary node delay seriously,so remove the node, stop instance and rm data, at last restart instance for sync data automatic.
Sync data, time to begin 2018.1.25 11:00:00, and end 2018.1.29 14:38:00.It lasts 4 days. And each node data is 2.5T.
But at 2018-01-29 14:26, it suddenly occured error. The deail message is:
com.mongodb.MongoTimeoutException: Timedout after 10000 ms while waiting for a server that matches {serverSelectors=[ReadPreferenceServerSelector

{readPreference=primary}

, LatencyMinimizingServerSelector

{acceptableLatencyDifference=15 ms}

]}. Client view of cluster state is {type=ReplicaSet, servers=[] at com.mongodb.BaseCluster.getServer(BaseCluster.java:82) at com.mongodb.DBTCPConnector.getServer(DBTCPConnector.java:664) at com.mongodb.DBTCPConnector.access$500(DBTCPConnector.java:40) at com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:513) at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:456) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:288) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:273) at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84) at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66) at com.mongodb.DBCollection.findOne(DBCollection.java:940) at com.mongodb.DBCollection.findOne(DBCollection.java:914) at com.mongodb.DBCollection.findOne(DBCollection.java:858) at

Please help me resolve the question. Thank you very much.



 Comments   
Comment by Ross Lawley [ 01/Feb/18 ]

Hi nycle,

The error reports a failure to connect to the primary server in the replicaset.
The "Client view of cluster state is {type=ReplicaSet, servers=[]". This shows that it hasn't been able to connect to any server, so the first place to check is how the MongoClient is constructed and the connectivity of the application to the cluster.

Just to let you know, the best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a boarder audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

If you do follow up on one of the above forums, please post a link here and I will endeavour to help there.

All the best,

Ross

Generated at Thu Feb 08 08:58:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.