Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB java driver - massive number of parked threads

In a long run I am seeing massive number of threads getting piled up by MongoDB Java driver (v3.0.3). All these threads are server monitoring threads, all parked waiting:

cluster-ClusterId{value='562233d1b26c940820028340', description='null'}-192.168.0.2:27017
    sun.misc.Unsafe.park(Native Method)
    java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
    com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.waitForSignalOrTimeout(DefaultServerMonitor.java:237)
    com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.waitForNext(DefaultServerMonitor.java:218)
    com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:167)
    java.lang.Thread.run(Unknown Source)

Right now there are about 250 of them. I don't think that many threads are needed to monitor a connection to a single database host. I am obviously doing something wrong.., but as far as I can tell we didn't do any setting changes when moved from driver v2 to v3. Could be a bug in driver? Any ideas?

like image 369
Dima Avatar asked Oct 30 '22 16:10

Dima


1 Answers

This issue has been fixed in 3.2.2.

https://jira.mongodb.org/browse/JAVA-2074

like image 74
Xinyuan.Yan Avatar answered Nov 15 '22 16:11

Xinyuan.Yan