Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-585

SocketTimeoutException: Read timed out

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.7.1
    • Connection Management
    • None
    • 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!

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            moctezuma pablo GM
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: