com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches PrimaryServerSelector. Client view of cluster state is {type=REPLICA_SET, servers=[{address=intdb01:27017, type=REPLICA_SET_SECONDARY, roundTripTime=0.7 ms, state=CONNECTED}]

Stack Overflow | Master Chief | 7 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Mongodb java client fails when Primary Server node changes in replicaset

    Stack Overflow | 7 months ago | Master Chief
    com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches PrimaryServerSelector. Client view of cluster state is {type=REPLICA_SET, servers=[{address=intdb01:27017, type=REPLICA_SET_SECONDARY, roundTripTime=0.7 ms, state=CONNECTED}]

    Root Cause Analysis

    1. com.mongodb.MongoTimeoutException

      Timed out after 30000 ms while waiting for a server that matches PrimaryServerSelector. Client view of cluster state is {type=REPLICA_SET, servers=[{address=intdb01:27017, type=REPLICA_SET_SECONDARY, roundTripTime=0.7 ms, state=CONNECTED}]

      at com.mongodb.connection.BaseCluster.createTimeoutException()
    2. MongoDB Java Driver
      MongoCollectionImpl.updateOne
      1. com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:370)
      2. com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:101)
      3. com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:75)
      4. com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:71)
      5. com.mongodb.binding.ClusterBinding.getWriteConnectionSource(ClusterBinding.java:68)
      6. com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:175)
      7. com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:141)
      8. com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:72)
      9. com.mongodb.Mongo.execute(Mongo.java:747)
      10. com.mongodb.Mongo$2.execute(Mongo.java:730)
      11. com.mongodb.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:482)
      12. com.mongodb.MongoCollectionImpl.update(MongoCollectionImpl.java:474)
      13. com.mongodb.MongoCollectionImpl.updateOne(MongoCollectionImpl.java:325)
      13 frames
    3. com.grid.core
      GridEventDao.save
      1. com.grid.core.persistence.mongodb.dao.GridEventDao.save(GridEventDao.java:69)
      1 frame