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

mongo driver should check whether socket still be available before use it?

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4
    • Component/s: None
    • None
    • Environment:
      mongodb 1.8

      After the driver open a socket to mongos,we shutdown mongos and restart it,then write two record into mongos,the first one will lost.

      We had set autoConnectRetry to true.

      The driver check if ( _socket == null ) only,should it check _socket can works fine also?

      There are some exceptions:

      Caused by: com.mongodb.MongoException$Network: can't say something
      at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:169) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:141) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:225) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:180) ~[mongo-java-driver-2.4-jar.jar:na]
      Caused by: java.net.SocketException: Broken pipe
      at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.6.0_16]
      at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) ~[na:1.6.0_16]
      at java.net.SocketOutputStream.write(SocketOutputStream.java:136) ~[na:1.6.0_16]
      at org.bson.io.PoolOutputBuffer.pipe(PoolOutputBuffer.java:113) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.OutMessage.pipe(OutMessage.java:157) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBPort.go(DBPort.java:92) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBPort.go(DBPort.java:66) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBPort.say(DBPort.java:61) ~[mongo-java-driver-2.4-jar.jar:na]
      at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:155) ~[mongo-java-driver-2.4-jar.jar:na]

            Assignee:
            Unassigned Unassigned
            Reporter:
            phoenix phoenix
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: