MongoDB – Resolving Connection Opening Exceptions

mongodb

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.
Here is the sample below

But I observed that this log below is its normal behaviour:
enter image description here

Another thing that I noticed before the error occur is that there are numerous "Unable to gather storage statistics for a slow operation due to lock aquire timeout"enter image description here

At the first time I encountered this issue. We set MaxConnectionPoolSize = 200; then it occurred again. Any idea how to fix this?

Best Answer

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 } )