Improve exception messaging when failing fast waiting for a connection

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.10.0
    • Affects Version/s: None
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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"

            Assignee:
            Bryan Reinero (Inactive)
            Reporter:
            Jeffrey Yemin
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: