we are using 4.3.4 java driver.
During scale up event, primary is undergoing a restart and application gets MongoSocketWriteException
in the middle of calling iterator() on collection.find() result.
is there a way to retry
we are using 4.3.4 java driver.
During scale up event, primary is undergoing a restart and application gets MongoSocketWriteException
in the middle of calling iterator() on collection.find() result.
is there a way to retry
com.mongodb.MongoSocketWriteException: Exception sending message
at com.mongodb.internal.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:665)
at com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:542)
at com.mongodb.internal.connection.InternalStreamConnection.sendCommandMessage(InternalStreamConnection.java:368)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:317)
at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:88)
at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:36)
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:129)
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.startHandshake(InternalStreamConnectionInitializer.java:71)
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:167)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:53)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:496)
at com.mongodb.internal.connection.DefaultConnectionPool$OpenConcurrencyLimiter.openWithConcurrencyLimit(DefaultConnectionPool.java:865)
at com.mongodb.internal.connection.DefaultConnectionPool$OpenConcurrencyLimiter.openOrGetAvailable(DefaultConnectionPool.java:806)
at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:155)
at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:145)
at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:92)
at com.mongodb.internal.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:141)
at com.mongodb.client.internal.ClientSessionBinding$SessionBindingConnectionSource.getConnection(ClientSessionBinding.java:163)
at com.mongodb.internal.operation.FindOperation$1.call(FindOperation.java:656)
at com.mongodb.internal.operation.FindOperation$1.call(FindOperation.java:653)
at com.mongodb.internal.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:583)
at com.mongodb.internal.operation.FindOperation.execute(FindOperation.java:653)
at com.mongodb.internal.operation.FindOperation.execute(FindOperation.java:81)
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:184)
at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:135)
at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:39)
at com.google.common.collect.Iterables$5.iterator(Iterables.java:742)
Most socket exceptions result in a retry with the 4.3.4 driver, but there are a few edge cases still that do not, and you ran into one of them: when the socket exception comes while opening a new connection.
We’re pretty close to addressing that in scope of https://jira.mongodb.org/browse/JAVA-4354. Please follow that issue to track progress.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.