[JAVA-585] SocketTimeoutException: Read timed out Created: 07/Jun/12  Updated: 12/Jul/12  Resolved: 12/Jul/12

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: 2.7.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: pablo GM Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB hosted in Windows Azure environment or MongoLabs, Grails 2.0.4



 Description   

We have the following time out issue in a Grails application with a single mongoDB instance hosted in a Windows Azure environment (we have also tried in MongoLabs and found the same issue), first time application works fine but if we don't perform any operation with mongoDB (like db.find, db.findOne, etc) in 5 minutes time period then the next query will throw a "Read timed out" exception, after that exception we need to retry again and it will work (this probably related to https://jira.mongodb.org/browse/JAVA-335)
The application has been deployed in cloudfoundry where we didn't see this error, application running with local mongoDB is running fine, so it's related to something in Azure environment and the driver (firewall was disabled and issue persists).

We have been reading about existing similar issues and these are the questions:

1) Do we need to manually retry when exception occurs?
https://jira.mongodb.org/browse/JAVA-481 - Driver not retrying on Connection timed out SocketException

2) Do we need to use any other configuration in the MongoOptions? we have tried different settings
socketKeepAlive = true, connectTimeout = 200, socketTimeout = 200, wtimeout = 1000 and autoConnectRetry = true and is not working.
https://groups.google.com/forum/?fromgroups#!topic/mongodb-dev/bPdUpcpyTZs

3) Is this an existing issue?

Read timed out. Stacktrace follows:
Message: Read timed out
Line | Method
->> 129 | read in java.net.SocketInputStream

  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    218 fill in java.io.BufferedInputStream
    258 read1 . . in ''
    317 read in ''
    35 readFully in org.bson.io.Bits
    28 readFully in ''
    39 <init> . in com.mongodb.Response
    128 go in com.mongodb.DBPort
    79 call . . in ''
    218 call in com.mongodb.DBTCPConnector
    305 __find . in com.mongodb.DBApiLayer$MyCollection
    369 _check in com.mongodb.DBCursor
    498 _hasNext in ''
    523 hasNext in ''

Please let us know any comment. Thanks!



 Comments   
Comment by Jeffrey Yemin [ 12/Jul/12 ]

Since I haven't heard back from you, I'm going to close this.

Comment by Jeffrey Yemin [ 07/Jun/12 ]

Hi there,

This is most likely more of a networking issue than anything having to do specifically with the Java driver. Can you post your question to https://groups.google.com/forum/#!forum/mongodb-user? There are more people on that list that are familar with Azure and MongoLabs.

Offhand, I would say:

1) In general, you do have to be prepared to handle exceptions thrown from DBCollection methods.
2) Your socket timeouts may be a bit short. Try something more in the range of 10 seconds.

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