-
Type:
Task
-
Resolution: Incomplete
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.0.2
-
Component/s: None
-
None
-
Environment:Redhat linux, Java, MongoDB java Driver 3.0.2
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hi,
We are running multiple threads, which are doing reads and writes operation at same point of time. One of the thread is reading from the database with time filter which is big enough to fetch 111000 records in one shot. The field in indexed in the collection. But, while this query is running it closes the connection pool and resulting the com.mongodb.MongoInterruptedException exception. Can you please tell me in what situation already open cursor will be closed abruptly where application has not initiated any close connection command. Below are the mongo-java-driver logs in trace mode. We are running single node of the mongo-database where mongodb version is 2.6.4 (Also tried with 3.2.8 wiredTiger but no luck) and mongo java driver 3.0.2 with java 8 and radhat linux environment.
2017/01/28 15:44:41.279 [MongoDbUtils] [SimpleAsyncTaskExecutor-4]: DEBUG: [588CBB1BE4B0F200BF2094F1] Getting Mongo Database name=[COLLECTIONNAME]
2017/01/28 15:44:41.280 [connection] [SimpleAsyncTaskExecutor-4]: TRACE: [588CBB1BE4B0F200BF2094F1] Checked out connection [connectionId
] to server HOST:27017
2017/01/28 15:44:41.280 [update] [SimpleAsyncTaskExecutor-4]: DEBUG: [588CBB1BE4B0F200BF2094F1] Updating documents in namespace COLLECTIONNAME.scheduled on connection [connectionId
] to server HOST:27017
2017/01/28 15:44:41.286 [connection] [pool-2-thread-2]: DEBUG: [588CBB3DE4B0F200BF2094FC] Closing connection connectionId
2017/01/28 15:44:41.289 [connection] [pool-2-thread-2]: TRACE: [588CBB3DE4B0F200BF2094FC] Checked in connection [connectionId
{localValue:10, serverValue:3246}] to server HOST:27017
2017/01/28 15:44:41.289 [connection] [pool-2-thread-2]: INFO: [588CBB3DE4B0F200BF2094FC] Closed connection [connectionId
] to HOST:27017 because the pool has been closed.
2017/01/28 15:44:41.289 [connection] [pool-2-thread-2]: DEBUG: [588CBB3DE4B0F200BF2094FC] Closing connection connectionId
2017/01/28 15:44:41.290 [connection] [pool-2-thread-2]: TRACE: [588CBB3DE4B0F200BF2094FC] Checked out connection [connectionId
{localValue:2, serverValue:3238}] to server HOST:27017
2017/01/28 15:44:41.290 [killcursor] [pool-2-thread-2]: DEBUG: [588CBB3DE4B0F200BF2094FC] Killing cursors [2428016239190] on connection [connectionId
] to server HOST:27017
2017/01/28 15:44:41.290 [connection] [pool-2-thread-2]: TRACE: [588CBB3DE4B0F200BF2094FC] Checked in connection [connectionId
] to server HOST:27017
2017/01/28 15:44:41.307 [update] [SimpleAsyncTaskExecutor-4]: DEBUG: [588CBB1BE4B0F200BF2094F1] Update completed
Caused by: com.mongodb.MongoInterruptedException: Interrupted acquiring a permit to retrieve an item from the pool
at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:186)
at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:126)
at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:109)
at com.mongodb.internal.connection.PowerOfTwoBufferPool.getBuffer(PowerOfTwoBufferPool.java:77)
at com.mongodb.connection.SocketStream.read(SocketStream.java:81)
at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:503)
at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221)
at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102)
at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:416)
at com.mongodb.connection.GetMoreProtocol.receiveMessage(GetMoreProtocol.java:112)
at com.mongodb.connection.GetMoreProtocol.execute(GetMoreProtocol.java:68)
at com.mongodb.connection.GetMoreProtocol.execute(GetMoreProtocol.java:37)
at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155)
at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219)
at com.mongodb.connection.DefaultServerConnection.getMore(DefaultServerConnection.java:194)
at com.mongodb.operation.QueryBatchCursor.getMore(QueryBatchCursor.java:197)
at com.mongodb.operation.QueryBatchCursor.hasNext(QueryBatchCursor.java:93)
at com.mongodb.MongoBatchCursorAdapter.hasNext(MongoBatchCursorAdapter.java:46)
at com.mongodb.DBCursor.hasNext(DBCursor.java:152)
at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1882)
... 156 more
Caused by: java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
at java.util.concurrent.Semaphore.acquire(Semaphore.java:312)
at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:182)
... 175 more