Delay after connection pool got cleared

We have a service written in NodeJS using MongoDB Atlas. We had a situation where the service was running and then the DB user password was changed. What we have seen in our logs for the connection pool is the following:

  • connection checkout started
  • connection failed due to auth error
  • connection checkout failed
  • connection pool got cleared
  • after 10 seconds (!), connection pool was ready again
  • this was repeated 5 times until the DB access failed

We are pretty sure that the delay and the retries are not from our code, therefore my question:

  • is the delay between “connection pool cleared” and “connection pool ready” expected?
  • if yes, is it configurable?
  • where do the retries come from?

Many thanks in advance!

@JRB if you changed the database user’s credentials that were initially provided to the application via the connection string, the application would have no way of discovering this without an updated connection string. The MongoClient would then need to be recreated with these updated details for the associated connection pool(s) to begin creating/checking in connections with this information.

The delays would all be attributed to events described in the Connection Monitoring and Pooling specification - not something you’re doing explicitly in code.

1 Like

You’ll never guess what I was just looking at and thinking exactly who would know what section it was in :smiley:

1 Like

Thanks for the link, interesting read :slight_smile:

I think I now understand what happens:

Would be great if I could get a confirmation for this (or tell me where I am wrong).

I think the main reason why we were running in such huge delays was to not having set waitQueueTimeoutMS. We should fail fast in case there are is some DB issue, not wait forever!