[JAVA-4216] DefaultConnectionPool and ConcurrentPool incorrectly handle some maxSize values Created: 30/Jun/21  Updated: 28/Oct/23  Resolved: 29/Jul/21

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: None
Fix Version/s: 4.4.0

Type: Bug Priority: Minor - P4
Reporter: Valentin Kavalenka Assignee: Valentin Kavalenka
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-4160 Clarify whether maxPoolSize allows 0 ... Closed
Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed

 Description   
  • If maxSize is 0, then
    • DefaultConnectionPool.createTimeoutException works incorrectly because it considers the value to be 0 instead of being infinite;
    • ConcurrentPool is created with 0 semaphore permits and does not allow creating connections.
  • If maxSize is negative, then
    • ConcurrentPool creates a semaphore with negative permits, which means connections must be released before they can be created. The ConcurrentPool docs state "if < 0 then no limit".


 Comments   
Comment by Githook User [ 29/Jul/21 ]

Author:

{'name': 'Valentin Kovalenko', 'email': 'valentin.kovalenko@mongodb.com', 'username': 'stIncMale'}

Message: Handle 0 maxSize in `DefaultConnectionPool` and allow passing 0 to `MongoClientOptions.Builder.maxSize` (#769)

JAVA-4216
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/d1d7b07b9fa54088ac7f6c6072898350522293e7

Generated at Thu Feb 08 09:01:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.