-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.4.0
-
Component/s: Connections
-
None
If you set a `min_pool_size` to 10 and not a `max_pool_size` you do not get a client error until you make the first query. It's easy to reproduce with:
client = Mongo::Client.new(['127.0.0.1:27017'], min_pool_size: 10) client[:example].find().first
the error it produces:
/Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/operation/executable.rb:39:in `block in execute': undefined method `dispatch' for nil:NilClass (NoMethodError) Did you mean? display from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/server/connection_pool.rb:110:in `with_connection' from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/server.rb:242:in `with_connection' from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/operation/executable.rb:35:in `execute' from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/collection/view/iterable.rb:81:in `send_initial_query' from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/collection/view/iterable.rb:41:in `block in each' from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/retryable.rb:51:in `read_with_retry' from /Users/anthonyross/.gem/ruby/2.3.1/gems/mongo-2.4.1/lib/mongo/collection/view/iterable.rb:39:in `each' from mongo.rb:8:in `first' from mongo.rb:8:in `<main>'
I would personally suggest that `max_pool_size` if not set would be `min_pool_size` + some default number (min_pool_size / 2 maybe?). I started on a patch based on this but I then realized that maybe an error should be raised if min > max.