[SOLVED] - MongoDb client not releasing connections

I’m still investigating this but I thought I would start the topic now just in case someone can save me some time. Our current deployment is not releasing connections (ever). It climbs to the max pool size and then stays there.

Reading the connections options it looks like setting the maxIdleTimeMS should work ( but hasn’t so far).

Are there some meteor configurations I should be looking at?

I’m currently doing a test where I set the maxPoolSize (35), minPoolSize(0), and maxIdleTimeMS(300000) to see what kind of behavior I will get. If that doesn’t work I’m going to try setting the keepAlive to ‘false’.

thank you ahead of time for any insight into the problem

Could you please share your Meteor version and MongoDb provider (or local).
This might help you to identify what are those connections … connecting: How Do I Query and Limit the Number of Connections?_Document Database Service_FAQs_Database Connection_HUAWEI CLOUD

A very useful script for our deployment was found here: https://stackoverflow.com/questions/8975531/check-the-current-number-of-connections-to-mongodb

  (accumulator, connection) => {
    ipaddress = connection.client ? connection.client.split(":")[0] : "Internal";
    accumulator[ipaddress] = (accumulator[ipaddress] || 0) + 1;
    return accumulator;

That shows the number of connections in the mongo pool climbing to the max pool size and then never dropping after that.

Our mongo database is version 3.6.6 (self hosted).

% cat .meteor/release

And success. The key configuration was setting that keepAlive to ‘false’ instead of letting it default to ‘true’.

Connections are now getting released from the mongo connection pool.

1 Like