[JAVA-2677]  Error while fetching data from Mongo DB com.mongodb.MongoSocketReadTimeoutException: Created: 28/Nov/17  Updated: 11/Sep/19  Resolved: 29/Nov/17

Status: Closed
Project: Java Driver
Component/s: Connection Management, Continuous Integration
Affects Version/s: 3.2.2
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: faisal Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux .mongo java 3.2.2


Attachments: PNG File timeout.PNG    

 Description   

Hi Mongo Team,

As we are facing the issue with mongo java drivers 3.2.2 , it is blocker for us we are not able to get the 100 TPS with mongo we are getting socket timeout, where as with orcle same application was working for 800 TPS.

 Error while fetching data from Mongo DB
com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message
        at com.mongodb.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:474)
        at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:225)
        at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102)
        at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:435)
        at com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:112)
        at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159)
        at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286)
        at com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:173)
        at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:215)
        at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:206)
        at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:112)
        at com.mongodb.operation.FindOperation$1.call(FindOperation.java:487)
        at com.mongodb.operation.FindOperation$1.call(FindOperation.java:482)
        at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:239)
        at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:212)
        at com.mongodb.operation.FindOperation.execute(FindOperation.java:482)
        at com.mongodb.operation.FindOperation.execute(FindOperation.java:79)
        at com.mongodb.Mongo.execute(Mongo.java:772)
        at com.mongodb.Mongo$2.execute(Mongo.java:759)
        at com.mongodb.OperationIterable.iterator(OperationIterable.java:47)
        at com.mongodb.FindIterableImpl.iterator(FindIterableImpl.java:143)
        at com.mongodb.FindIterableImpl.iterator(FindIterableImpl.java:36)
 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:152)
        at java.net.SocketInputStream.read(SocketInputStream.java:122)
        at com.mongodb.connection.SocketStream.read(SocketStream.java:85)
        at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491)
        at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221)

We are connecting to MONGO shared database and below are the tuning parameters.

conenctionsperhost = 30
minconnections =5
maxidletime=1800000

Please suggest if we required tune something.



 Comments   
Comment by Ross Lawley [ 29/Nov/17 ]

Hi faisal,

Just to let you know this project is for Java driver bugs or feature requests. 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 via one of the options above please post a link and I will follow the conversation there.

All the best,

Ross

Comment by faisal [ 28/Nov/17 ]

in linux machine tcp kkep alive is like below.
net.ipv4.tcp_keepalive_time = 7200

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