[JAVA-1889] Connection Pool fails to release connection if openAsync fails Created: 15/Jul/15  Updated: 16/May/17  Resolved: 15/Jul/15

Status: Closed
Project: Java Driver
Component/s: Async, Connection Management
Affects Version/s: 3.0.0
Fix Version/s: 3.1.0

Type: Bug Priority: Major - P3
Reporter: Denis Orlov Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 8


Attachments: Java Source File Test.java     Text File case-1-timeout-first request.txt     Text File case-2-last-connection-timed-out.txt    
Case:

 Description   

Using async mongo driver I create replica set connection to mongo DB:

ClusterSettings:
ClusterType.REPLICA_SET
ClusterConnectionMode.MULTIPLE

ConnectionPoolSettings:
maxSize:1
minSize:1
maxWaitTime: 1 sec
maxWaitQueueSize: 100

SocketSettings:
connectTimeout: 100 sec
readTimeout: 50 millis

Issue:
When last connection from pool gets "com.mongodb.MongoSocketReadTimeoutException Timeout while receiving message" no futher connections will be created and all requests will be rejected with "com.mongodb.MongoTimeoutException Timeout waiting for a pooled item after"

The main idea in my case, to setup read very small read time out and do not wait server response in case it is slow for the moment. But when last connection (only one for test case) gets TimeOut, ConcurrentPool doesn't release semaphore permit.

Check attached logs



 Comments   
Comment by Jeffrey Yemin [ 16/Jul/15 ]

Fix is now available in the 3.0.3 release.

Comment by Githook User [ 15/Jul/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Release the usage connection when failing in openAsync

JAVA-1889
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/9802eb3b239404c0cef9e617e4b96bab0f8089d4

Comment by Githook User [ 15/Jul/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Handle null result in CommandHelper

JAVA-1889
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/62babe9ad5986cb78a797edaf9f5b1a833106848

Comment by Githook User [ 15/Jul/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Release the usage connection when failing in openAsync

JAVA-1889
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/97e160e9a28ba5f288c3ecaae75d8d1b2da36d1a

Comment by Githook User [ 15/Jul/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Handle null result in CommandHelper

JAVA-1889
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/15e14635e80d9167c96e271b9b96fb30c9fccac0

Comment by Ross Lawley [ 15/Jul/15 ]

Thanks dorlov - I've identified the issue and updated the title of the ticket.

Comment by Denis Orlov [ 15/Jul/15 ]

Ross, test java class is committed. Unfortunately I couldn't provide you an access to our mongo db.

Comment by Ross Lawley [ 15/Jul/15 ]

Thanks for reporting dorlov, I'm just going to try to reproduce now. If you have any test code that reproduces the issue that would help speed the issue on!

Ross

Generated at Thu Feb 08 08:55:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.