question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timeout with mongodb

See original GitHub issue

Hello I’ve been trying to run ycsb against mongodb, and see the following issue.

[root@ycsb-data-load-job /]# mongo "mongodb://mongo-0.mongo,mongo-1.mongo/dbname_?"                                                                                                                                
MongoDB shell version v4.0.10                                                                                                                                                                                      
connecting to: mongodb://mongo-0.mongo:27017,mongo-1.mongo:27017/dbname_?gssapiServiceName=mongodb                                                                                                                 
Implicit session: session { "id" : UUID("7ce3c8f6-4ec5-43c4-a9ed-607a9849c499") }                                                                                                                                  
MongoDB server version: 4.0.10                                                                                                                                                                                     
Server has startup warnings:                                                                                                                                                                                       
2019-06-24T21:56:38.640+0000 I STORAGE  [initandlisten]                                                                                                                                                            
2019-06-24T21:56:38.640+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 
2019-06-24T21:56:38.640+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem                                                                                        
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten]                                                                                                                                                            
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.                                                                                                
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.                                                                               
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.                                                                       
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten]                                                                                                                                                            
---                                                                                                                                                                                                                
Enable MongoDB's free cloud-based monitoring service, which will then receive and display                                                                                                                          
metrics about your deployment (disk utilization, CPU, operation statistics, etc).                                                                                                                                  
                                                                                                                                                                                                                   
The monitoring data will be available on a MongoDB website with a unique URL accessible to you                                                                                                                     
and anyone you share the URL with. MongoDB may use this information to make product                                                                                                                                
improvements and to suggest MongoDB products and deployment options to you.                                                                                                                                        
                                                                                                                                                                                                                   
To enable free monitoring, run the following command: db.enableFreeMonitoring()                                                                                                                                    
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()                                                                                                                        
---                                                                                                                                                                                                                
                                                                                                                                                                                                                   
> exit                                                                                                                                                                                                             
bye                                                                                                                                                                                                                
[root@ycsb-data-load-job /]# mongo "mongodb://mongo-0.mongo,mongo-1.mongo/ycsb"                                                                                                                                    
MongoDB shell version v4.0.10                                                                                                                                                                                      
connecting to: mongodb://mongo-0.mongo:27017,mongo-1.mongo:27017/ycsb?gssapiServiceName=mongodb                                                                                                                    
Implicit session: session { "id" : UUID("d9538a20-1e80-455f-b87e-13b689653f44") }                                                                                                                                  
MongoDB server version: 4.0.10                                                                                                                                                                                     
Server has startup warnings:                                                                                                                                                                                       
2019-06-24T21:56:38.640+0000 I STORAGE  [initandlisten]                                                                                                                                                            
2019-06-24T21:56:38.640+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine                                                            
2019-06-24T21:56:38.640+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem                                                                                        
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten]                                                                                                                                                            
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.                                                                                                
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.                                                                               
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.                                                                       
2019-06-24T21:56:39.352+0000 I CONTROL  [initandlisten]                                                                                                                                                            
---                                                                                                                                                                                                                
Enable MongoDB's free cloud-based monitoring service, which will then receive and display                                                                                                                          
metrics about your deployment (disk utilization, CPU, operation statistics, etc).                                                                                                                                  
                                                                                                                                                                                                                   
The monitoring data will be available on a MongoDB website with a unique URL accessible to you                                                                                                                     
and anyone you share the URL with. MongoDB may use this information to make product                                                                                                                                
improvements and to suggest MongoDB products and deployment options to you.                                                                                                                                        
                                                                                                                                                                                                                   
To enable free monitoring, run the following command: db.enableFreeMonitoring()                                                                                                                                    
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()                                                                                                                        
---                                                                                                                                                                                                                
                                                                                                                                                                                                                   
> exit                                                                                                                                                                                                             
bye                                                                                                                                                                                                                
[root@ycsb-data-load-job /]# /ycsb/bin/ycsb load mongodb -s -P /ycsb/workloads/workloada -p mongodb.url='mongodb://mongo-0.mongo,mongo-1.mongo/ycsb'                                                               
java -cp /ycsb/mongodb-binding/conf:/ycsb/conf:/ycsb/lib/htrace-core4-4.1.0-incubating.jar:/ycsb/lib/core-0.15.0.jar:/ycsb/lib/jackson-mapper-asl-1.9.4.jar:/ycsb/lib/jackson-core-asl-1.9.4.jar:/ycsb/lib/HdrHisto
gram-2.1.4.jar:/ycsb/mongodb-binding/lib/snappy-java-1.1.7.1.jar:/ycsb/mongodb-binding/lib/mongodb-binding-0.15.0.jar:/ycsb/mongodb-binding/lib/slf4j-api-1.7.25.jar:/ycsb/mongodb-binding/lib/logback-classic-1.1.
2.jar:/ycsb/mongodb-binding/lib/logback-core-1.1.2.jar:/ycsb/mongodb-binding/lib/mongo-java-driver-3.6.3.jar:/ycsb/mongodb-binding/lib/mongodb-async-driver-2.0.1.jar com.yahoo.ycsb.Client -db com.yahoo.ycsb.db.M
ongoDbClient -s -P /ycsb/workloads/workloada -p mongodb.url=mongodb://mongo-0.mongo,mongo-1.mongo/ycsb -load                                                                                                       
Command line: -db com.yahoo.ycsb.db.MongoDbClient -s -P /ycsb/workloads/workloada -p mongodb.url=mongodb://mongo-0.mongo,mongo-1.mongo/ycsb -load                                                                  
YCSB Client 0.15.0                                                                                                                                                                                                 
                                                                                                                                                                                                                   
Loading workload...   
Starting test.
2019-06-24 22:22:23:875 0 sec: 0 operations; est completion in 0 second 
mongo client connection created with mongodb://mongo-0.mongo,mongo-1.mongo/ycsb
DBWrapper: report latency for each error is false and specific error codes to track for latency are: []
2019-06-24 22:22:33:855 10 sec: 0 operations; est completion in 106751991167300 days 15 hours 
2019-06-24 22:22:43:855 20 sec: 0 operations; est completion in 106751991167300 days 15 hours 
2019-06-24 22:22:53:855 30 sec: 0 operations; est completion in 106751991167300 days 15 hours 
Exception while trying bulk insert with 0
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=mongo-0.mongo:27017, type=REPLICA_SET_GHOST, roundTripTime=0.9 ms, state=CONNECTED}, {address=mongo-1.mongo:27017, type=REPLICA_SET_GHOST, roundTripTime=0.9 ms, state=CONNECTED}]
        at com.mongodb.connection.BaseCluster.getDescription(BaseCluster.java:167)
        at com.mongodb.Mongo.getConnectedClusterDescription(Mongo.java:885)
        at com.mongodb.Mongo.createClientSession(Mongo.java:877)
        at com.mongodb.Mongo$3.getClientSession(Mongo.java:866)
        at com.mongodb.Mongo$3.execute(Mongo.java:834)
        at com.mongodb.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1025)
        at com.mongodb.MongoCollectionImpl.executeInsertOne(MongoCollectionImpl.java:513)
        at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:493)
        at com.mongodb.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:487)
        at com.yahoo.ycsb.db.MongoDbClient.insert(MongoDbClient.java:270)
        at com.yahoo.ycsb.DBWrapper.insert(DBWrapper.java:221)
        at com.yahoo.ycsb.workloads.CoreWorkload.doInsert(CoreWorkload.java:588)
        at com.yahoo.ycsb.ClientThread.run(Client.java:468)
        at java.lang.Thread.run(Thread.java:748)
Error inserting, not retrying any more. number of attempts: 1Insertion Retry Limit: 0
2019-06-24 22:22:54:156 30 sec: 0 operations; est completion in 106751991167300 days 15 hours [CLEANUP: Count=1, Max=1261, Min=1261, Avg=1261, 90=1261, 99=1261, 99.9=1261, 99.99=1261] [INSERT: Count=0, Max=0, Min=9223372036854775807, Avg=?, 90=0, 99=0, 99.9=0, 99.99=0] [INSERT-FAILED: Count=1, Max=30015487, Min=29999104, Avg=30007296, 90=30015487, 99=30015487, 99.9=30015487, 99.99=30015487] 
[OVERALL], RunTime(ms), 30301
[OVERALL], Throughput(ops/sec), 0.0
[TOTAL_GCS_Copy], Count, 0
[TOTAL_GC_TIME_Copy], Time(ms), 0
[TOTAL_GC_TIME_%_Copy], Time(%), 0.0
[TOTAL_GCS_MarkSweepCompact], Count, 0
[TOTAL_GC_TIME_MarkSweepCompact], Time(ms), 0
[TOTAL_GC_TIME_%_MarkSweepCompact], Time(%), 0.0
[TOTAL_GCs], Count, 0
[TOTAL_GC_TIME], Time(ms), 0
[TOTAL_GC_TIME_%], Time(%), 0.0
[CLEANUP], Operations, 1
[CLEANUP], AverageLatency(us), 1261.0
[CLEANUP], MinLatency(us), 1261
[CLEANUP], MaxLatency(us), 1261
[CLEANUP], 95thPercentileLatency(us), 1261
[CLEANUP], 99thPercentileLatency(us), 1261
[INSERT], Operations, 0
[INSERT], AverageLatency(us), NaN
[INSERT], MinLatency(us), 9223372036854775807
[INSERT], MaxLatency(us), 0
[INSERT], 95thPercentileLatency(us), 0
[INSERT], 99thPercentileLatency(us), 0
[INSERT], Return=ERROR, 1
[INSERT-FAILED], Operations, 1
[INSERT-FAILED], AverageLatency(us), 3.0007296E7
[INSERT-FAILED], MinLatency(us), 29999104
[INSERT-FAILED], MaxLatency(us), 30015487
[INSERT-FAILED], 95thPercentileLatency(us), 30015487
[INSERT-FAILED], 99thPercentileLatency(us), 30015487

As you can see I can connect fine, not sure what’s wrong while running ycsb, tried other workloads but no success.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
allanbankcommented, Jun 27, 2019

Right - the replica set cannot come up. mongo-1 cannot connect to mongo-0 either because it cannot resolve the hostname “mongo-0”.

I’m going to suggest you tear down the cluster again and the use this command to initialize the replica set:

rs.initiate( {
   _id : "rs0",
   members: [
      { _id: 0, host: "mongo-0.mongo:27017" },
      { _id: 1, host: "mongo-1.mongo:27017" }
   ]
})
0reactions
aakarshgcommented, Jun 27, 2019

Hey @allanbank that helped, it wasn’t an issue with ycsb but rather with the way I had deployed mongodb. The problem was fixed once I redeployed and initialized the replicaset. Thanks for the help.

Closing this as this wasn’t an issue with ycsb but rather with how mongo was deployed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect timeout and execution timeout in nodejs driver
The connectTimeoutMS option is used by the driver to determine when to timeout an attempt to connect an individual connection to a server...
Read more >
How to fix MongoDB connection timeout? - Bobcares
The connection timeout determines the maximum amount of response time that waits for a connection established by the server. This value is used ......
Read more >
mongodb connection timed out error - Stack Overflow
For anyone looking to set the initial database connection timeout, you can do so via serverSelectionTimeoutMS . Currently this option is not ...
Read more >
Client Side Operations Timeout - mongodb/specifications
This 64-bit integer option specifies the per-operation timeout value in milliseconds. The default value is unset which means this feature is not enabled,...
Read more >
Operation Timeout in MongoDB - Medium
Today I'd like to talk about a problem every MongoDB developer should be aware of — operation timeout. I have surely risen a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found