An exception occurred while opening a connection to the server I've encountered this from time to time and I cant seem to find the fix.
Usually when this error occur, I am seeing increasing number of connections being used while its connection is not being disconnected.
Here is a sample logs on mongo.

But I observed that this log below is its normal behaviour:

Another thing that I noticed before the error occur is that there are numerous &quot;Unable to gather storage statistics for a slow operation due to lock aquire timeout&quot;
At the first time I encountered this issue. We set MaxConnectionPoolSize = 200; then it occurred again. Any idea how to fix this?
I guess it is a locking problem. You should open profiler and watch which queries are locking each other.
Otherwise may be you can try it after researches.
Document.
db.adminCommand( { setParameter: 1, maxTransactionLockRequestTimeoutMillis: 200 } )