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

ConcurrentPool doesn't release semaphore permit properly after com.mongodb.MongoSocketException:<host_name_of_read_replica>

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.11.2
    • Component/s: Async
    • None

      One of our application's node was faced with some network issues, yet the node did not completely restore its operation after the issue was gone.  
      It faced the increased number of errors "com.mongodb.MongoTimeoutException: Timeout waiting for a pooled item after.."

      During network issues connections were closed because of com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message. After network issues were gone opening new connections were failed for only one of two read replicas with 
      com.mongodb.MongoSocketException:<host_name_of_read_replica>
      For second read replica connections were opened successfully.

      Mongo Async driver v3.11.2

      ClusterSettings: 
      type=REPLICA_SET_SECONDARY

      ConnectionOptions: maxPoolSize=10&minPoolSize=10&w=1&wtimeoutMS=500&j=0&connectTimeoutMS=500&socketTimeoutMS=2000&readPreference=secondaryPreferred&waitQueueMultiple=5&waitQueueTimeoutMS=2000&replicaSet=rs0

      Issue:
      I assume that during com.mongodb.MongoSocketException:<host_name_of_read_replica> ConcurrentPool doesn't release semaphore permit properly. As a result, application faced with errors like "com.mongodb.MongoTimeoutException: Timeout waiting for a pooled item after.."

      Please see the attached stacktrace with some obfuscation for more detailes.

        1. Error in background maintenance task.txt
          4 kB
        2. Error in callback.txt
          27 kB
        3. Error in monitor thread.txt
          2 kB

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            anastasiya.kaluzhonak@gmail.com Anastasiya Kaluzhonak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: