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

Driver not retrying on Connection timed out SocketException

      I've got a MongoDB replica set across two datacenters. In my second data center I have some servers that point back to the primary instance in data center 1.

      I ran into a connection timeout issue (this happens pretty consistently) on the server, here is the stack trace:

      com.mongodb.DBPortPool gotError
      WARNING: emptying DBPortPool to b/c of error
      java.net.SocketException: Connection timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:129)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
      at org.bson.io.Bits.readFully(Bits.java:35)
      at org.bson.io.Bits.readFully(Bits.java:28)
      at com.mongodb.Response.<init>(Response.java:39)
      at com.mongodb.DBPort.go(DBPort.java:123)
      at com.mongodb.DBPort.go(DBPort.java:82)
      at com.mongodb.DBPort.call(DBPort.java:72)
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:202)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:303)
      at com.mongodb.DBCollection.findOne(DBCollection.java:565)
      at com.mongodb.DBCollection.findOne(DBCollection.java:554)

      Is it possible for the driver to attempt recreate the connections and retry the query? It looks like the next query worked as expected.

      I do not see these errors on servers in the same data center as the primary mongodb server

      Note: latency between the my app server and the primary mongodb server is ~50 ms


            mariano.escribano@mongodb.com Mariano Escribano
            jed204 John Danner
            0 Vote for this issue
            7 Start watching this issue