-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 3.4.1
-
Component/s: Connection Management
-
None
I use version 3.4.1 and get the following exception during restart of the application:
exception thrown during connection pool background maintenance task
java.lang.InterruptedException: null at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source) at java.util.concurrent.Semaphore.acquire(Unknown Source) at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:182) ... 38 common frames omitted Wrapped 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:76) at com.mongodb.connection.SocketStream.getBuffer(SocketStream.java:69) at com.mongodb.connection.InternalStreamConnection.getBuffer(InternalStreamConnection.java:514) at com.mongodb.connection.ByteBufferBsonOutput.getByteBufferAtIndex(ByteBufferBsonOutput.java:91) at com.mongodb.connection.ByteBufferBsonOutput.getCurrentByteBuffer(ByteBufferBsonOutput.java:80) at com.mongodb.connection.ByteBufferBsonOutput.writeByte(ByteBufferBsonOutput.java:75) at org.bson.io.OutputBuffer.write(OutputBuffer.java:150) at org.bson.io.OutputBuffer.writeInt32(OutputBuffer.java:56) at com.mongodb.connection.RequestMessage.writeMessagePrologue(RequestMessage.java:171) at com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:159) at com.mongodb.connection.RequestMessage.encode(RequestMessage.java:147) at com.mongodb.connection.CommandHelper.sendMessage(CommandHelper.java:88) at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) at com.mongodb.connection.SaslAuthenticator.sendSaslContinue(SaslAuthenticator.java:121) at com.mongodb.connection.SaslAuthenticator.access$100(SaslAuthenticator.java:37) at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:63) ... 20 common frames omitted Wrapped by: com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='composing', source='composing', password=<hidden>, mechanismProperties={}} at com.mongodb.connection.SaslAuthenticator.wrapInMongoSecurityException(SaslAuthenticator.java:157) at com.mongodb.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:37) at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:66) at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:44) at com.mongodb.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:162) at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:44) at com.mongodb.connection.DefaultAuthenticator.authenticate(DefaultAuthenticator.java:32) at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:109) at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:46) at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:116) at com.mongodb.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:47) at com.mongodb.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:494) at com.mongodb.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:482) at com.mongodb.internal.connection.ConcurrentPool.createNewAndReleasePermitIfFailure(ConcurrentPool.java:164) at com.mongodb.internal.connection.ConcurrentPool.ensureMinSize(ConcurrentPool.java:158) at com.mongodb.connection.DefaultConnectionPool$3.run(DefaultConnectionPool.java:302) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception thrown during connection pool background maintenance task
There exists already the issue JAVA-2123. But the solution does not seem to work here. In that solution the provided bugfix catched the MongoInteruptedException. But in this exception the MongoInteruptedException gets wrapped inside a securityException. Thats why the catch block in the defaultConnectionPool is not working.