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

Set a sane default socketTimeout

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 2.11.1
    • None
    • None

    Description

      The current default is to have no socket timeout at all, in case of a replicaset when a primary is not reachable this blocks server threads that try to write.
      I would consider this a bad default, it makes a lot more sense to have a sane default of say 120s to allow the software to gracefully handle this situation, now due to the current setup, it caused thread starvation on our Glassfish server so it went completely down, while read operations should have still been possible IMHO.

      Trace logs:

      Thread Synchronization Statistics:
      -----------------------
      Number of times this thread was blocked (to enter/reenter a Monitor): 2
      Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 11,596
      Total CPU time for this thread: 32 seconds 617,224,466 nanoseconds.
      User-level CPU time for this thread: 32 seconds 617,224,466 nanoseconds.
      Object Monitors currently held or requested by this thread: []
      Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: []
      --------------------------------------------------------------------------------
      Thread Execution Information:
      -----------------------
      Thread "http-thread-pool-8080(5)" thread-id: 56 thread-state: RUNNABLE Running in native
      at: java.net.SocketInputStream.socketRead0(Native Method)
      at: java.net.SocketInputStream.read(SocketInputStream.java:150)
      at: java.net.SocketInputStream.read(SocketInputStream.java:121)
      at: java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
      at: java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
      at: java.io.BufferedInputStream.read(BufferedInputStream.java:334)
      at: org.bson.io.Bits.readFully(Bits.java:46)
      at: org.bson.io.Bits.readFully(Bits.java:33)
      at: org.bson.io.Bits.readFully(Bits.java:28)
      at: com.mongodb.Response.<init>(Response.java:40)
      at: com.mongodb.DBPort.go(DBPort.java:124)
      at: com.mongodb.DBPort.go(DBPort.java:88)
      at: com.mongodb.DBPort.findOne(DBPort.java:143)
      at: com.mongodb.DBPort.runCommand(DBPort.java:148)
      at: com.mongodb.DBTCPConnector._checkWriteError(DBTCPConnector.java:140)
      at: com.mongodb.DBTCPConnector.say(DBTCPConnector.java:183)
      at: com.mongodb.DBTCPConnector.say(DBTCPConnector.java:155)
      at: com.mongodb.DBApiLayer$MyCollection.update(DBApiLayer.java:349)
      at: com.mongodb.DBCollection.update(DBCollection.java:177)
      at: com.mongodb.DBCollection.update(DBCollection.java:208)
      at: com.mongodb.DBCollection.update(DBCollection.java:220)

      Attachments

        Activity

          People

            Unassigned Unassigned
            jayv Jo Voordeckers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: