[JAVA-574] Improve exception messaging when failing fast waiting for a connection Created: 24/May/12  Updated: 26/Nov/12  Resolved: 16/Nov/12

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 2.10.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Bryan Reinero
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The maximum number of threads that the driver allows to have waiting in a queue for a connection from the pool is

_options.connectionsPerHost * _options.threadsAllowedToBlockForConnectionMultiplier

which defaults to 50 (10 * 5).

Past that number the driver throws a SemaphoresOut exception with the message "Out of semaphores to get db connection".

This is confusing to users, since the fact that the driver uses a semaphore to enforce this limit is not something users generally need to be aware of.

The driver should throw a less confusing exception with a message more like "Exceeded the maximum number of threads that may be waiting for a connection to become available from the pool. The maximum is calculated as the product of connectionsPerHost (10) and threadsAllowedToBlockForConnectionMultiplier (5) in com.mongodb.MongoOptions"



 Comments   
Comment by Jeffrey Yemin [ 16/Nov/12 ]

I had a typo on my commit message. This fix is actually for this bug:

Author:

{u'date': u'2012-11-16T21:16:13Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-674: Fixed exception messaging for number of concurrent requests allowed
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/a38b467ca2d1ac14b2e4fbd3d1cd0033cdeb4dd2

Comment by Jeffrey Yemin [ 16/Nov/12 ]

Need to fix the total number of concurrent requests reported by the exception

Comment by Bryan Reinero [ 26/Sep/12 ]

https://github.com/mongodb/mongo-java-driver/commit/8e5de4304f1bc29904a6508e34000482e7a9f685

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