elixir-mongo / mongodb

MongoDB driver for Elixir
Apache License 2.0
571 stars 156 forks source link

Too many connections created #284

Closed rblack closed 5 years ago

rblack commented 5 years ago

Hi! Using mongodb v0.5.0 with single MongoDB 3.4 instance. Settingpool_size option to 20 leads to 420 connections created according to db.serverStatus().connections in a mongodb shell. Tried to determine whether there is some pattern and found out the following (first value pool_size, second — current connections including one made from shell): 2: 7 4: 21 6: 43 10: 111 15: 241 20: 421 Tested in iex shell with Mongo.start_link(url: “mongodb://localhost:27017/db-name”, pool_size: 20) Docs are outdated at the moment, so I may be missing something, but anyway this is odd behavior.

ankhers commented 5 years ago

Thank you for catching and reporting this! It is an issue with our internal monitors. Each monitor should only have a single connection, but we are accidentally starting a pool of connections. Resolved in 8979c0abd30f984ecadd2b1e23d2649a9cf8ecfa.