Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Pool startup error after updating mongo-java-driver from 3.0.3 to 3.2.2

1,344 views
Skip to first unread message

Alex Paransky

unread,
Feb 24, 2016, 10:21:49 AM2/24/16
to mongodb-user
I updated to the latest mongo-java-driver (3.2.2) and now get this exception during my application initialization:

2016-02-24 07:15:20,383 ws-dashboard WARN [pool-1-thread-1] org.mongodb.driver.connection [SLF4JLogger.java:91] Exception thrown while ensuring minimum pool size
com.mongodb.MongoInterruptedException: Interrupted acquiring a permit to retrieve an item from the pool 
at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:186) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:126) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:109) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.internal.connection.PowerOfTwoBufferPool.getBuffer(PowerOfTwoBufferPool.java:76) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.SocketStream.read(SocketStream.java:81) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:503) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.CommandHelper.receiveReply(CommandHelper.java:134) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:121) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) ~[mongo-java-driver-3.2.2.jar:na]
at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83) ~[mongo-java-driver-3.2.2.jar:na]

Here is the definition of my MongoClientOptions:

    public MongoClientOptions mongoClientOptions() {
        return
            MongoClientOptions
                .builder()
                .connectionsPerHost(connectionsPerHost)
                //.minConnectionsPerHost(connectionsPerHost)
                .writeConcern(WriteConcern.SAFE)
                .readPreference(
                    readFrom == ReadFrom.PRIMARY
                        ? ReadPreference.primary()
                        : ReadPreference.secondary()
                )
                .connectTimeout(connectTimeout)
                .build();
    }


So, I want to start the pool with a constant number of connections.  If I comment out the .minConnectionsPerHost() setting, then I don't get the above exception.  Is there an additional timeout that I need to adjust to make this work?

Thanks.
-AP_

Alex Paransky

unread,
Feb 24, 2016, 3:10:06 PM2/24/16
to mongodb-user
I tested with different drivers:

3.0.2 works
3.0.4 works
3.1.1 works
3.2.1 fails with exception above
3.2.2 fails with exception above

Alex Paransky

unread,
Feb 24, 2016, 10:13:22 PM2/24/16
to mongodb-user
Reply all
Reply to author
Forward
0 new messages