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

JAva Driver Hangs with when replica set down

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.4
    • None
    • Environment:
      Ubuntu 18.04. running mongodb in docker

      Hi,

      I am using spring data mongo (2.0.8) which is using mongo driver(3.6.4). I am using docker to setup my replica set cluster.

      There is a weird thing happening when one of the nodes goes down and when I restart my app again. It hangs at the line

      [2019-05-27 15:52:55,341] [main] INFO  connection:71 - Opened connection [connectionId{localValue:4, serverValue:6}] to mongodbms_2:27017
      

      where mongodbms_2 is the master node running.
      Then., I added the 'socketTimeout' and 'connectTimeout' property to 5000 and now app start and try to connect successfully but then it pass the above line and give error as below

      Caused by: com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving messageCaused by: com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message at com.mongodb.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:530) at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:421) at com.mongodb.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:290)
      
      ................
      ................
      Caused by: java.net.SocketTimeoutException: Read timed outCaused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method)

       

      And then it shutsdown the whole application instead of stopped looking for a failed MongoDB node or keep looking but not to hang or stop the application.

      I have two questions:

      1) Why it is hanging when not passing the sockerTimeout or connectTimeout property

      2) If passing property then why it is just failed to start the app.

            Assignee:
            Unassigned Unassigned
            Reporter:
            muzzamongo Muzzammil Ayyubi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: