From 09bf7801a682c77a55934d50af367888c7e62a85 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sun, 27 Jul 2025 19:47:53 -0700 Subject: [PATCH 1/6] Use connectTimeoutMS for connection establishment in maintenance timeout context. JAVA-5927 --- .../com/mongodb/internal/TimeoutContext.java | 4 ++ .../connection/SocketStreamHelper.java | 5 --- ...tClientSideOperationsTimeoutProseTest.java | 38 +++++++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/driver-core/src/main/com/mongodb/internal/TimeoutContext.java b/driver-core/src/main/com/mongodb/internal/TimeoutContext.java index ba3b8eb0ac5..fbf183d05fe 100644 --- a/driver-core/src/main/com/mongodb/internal/TimeoutContext.java +++ b/driver-core/src/main/com/mongodb/internal/TimeoutContext.java @@ -289,6 +289,10 @@ public long getWriteTimeoutMS() { public int getConnectTimeoutMs() { final long connectTimeoutMS = getTimeoutSettings().getConnectTimeoutMS(); + if (isMaintenanceContext) { + return (int) connectTimeoutMS; + } + return Math.toIntExact(Timeout.nullAsInfinite(timeout).call(MILLISECONDS, () -> connectTimeoutMS, (ms) -> connectTimeoutMS == 0 ? ms : Math.min(ms, connectTimeoutMS), diff --git a/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java b/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java index 74098c4ede6..c919007651f 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java +++ b/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java @@ -79,11 +79,6 @@ static void initialize(final OperationContext operationContext, final Socket soc static void configureSocket(final Socket socket, final OperationContext operationContext, final SocketSettings settings) throws SocketException { socket.setTcpNoDelay(true); socket.setKeepAlive(true); - int readTimeoutMS = (int) operationContext.getTimeoutContext().getReadTimeoutMS(); - if (readTimeoutMS > 0) { - socket.setSoTimeout(readTimeoutMS); - } - // Adding keep alive options for users of Java 11+. These options will be ignored for older Java versions. setExtendedSocketOptions(socket); diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java index 5cb042eaad4..1f2b052143b 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java @@ -47,6 +47,7 @@ import com.mongodb.event.ConnectionClosedEvent; import com.mongodb.event.ConnectionCreatedEvent; import com.mongodb.event.ConnectionReadyEvent; +import com.mongodb.internal.connection.InternalStreamConnection; import com.mongodb.internal.connection.ServerHelper; import com.mongodb.internal.connection.TestCommandListener; import com.mongodb.internal.connection.TestConnectionPoolListener; @@ -908,6 +909,43 @@ public void shouldThrowTimeoutExceptionForSubsequentCommitTransaction() { assertEquals(1, failedEvents.size()); } + /** + * Not a prose spec test. However, it is additional test case for better coverage. + *

+ * From the spec: + * - When doing `minPoolSize` maintenance, `connectTimeoutMS` is used as the timeout for socket establishment. + */ + @Test + public void shouldUseConnectTimeoutMSWhenEstablishingConnectionInBackground() { + assumeTrue(serverVersionAtLeast(4, 4)); + + collectionHelper.runAdminCommand("{" + + " configureFailPoint: \"failCommand\"," + + " mode: \"alwaysOn\"," + + " data: {" + + " failCommands: [\"hello\", \"isMaster\"]," + + " blockConnection: true," + + " blockTimeMS: " + 500 + + " }" + + "}"); + + try (MongoClient mongoClient = createMongoClient(getMongoClientSettingsBuilder() + .applyToConnectionPoolSettings(builder -> builder.minSize(1)) + // Use a very short timeout to ensure that the connection establishment will fail on the first handshake command. + .timeout(1, TimeUnit.MILLISECONDS))) { + InternalStreamConnection.setRecordEverything(true); + + // Wait for the connection to start establishment in the background + sleep(1000); + } + List commandStartedEvents = commandListener.getCommandStartedEvents("isMaster"); + assertEquals(1, commandStartedEvents.size()); + + List commandFailedEvents = commandListener.getCommandFailedEvents("isMaster"); + assertEquals(1, commandFailedEvents.size()); + assertInstanceOf(MongoOperationTimeoutException.class, commandFailedEvents.get(0).getThrowable()); + } + private static Stream test8ServerSelectionArguments() { return Stream.of( Arguments.of(Named.of("serverSelectionTimeoutMS honored if timeoutMS is not set", From 2d6201d5eae308b04191e1feba31bf27eedc0cc4 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sun, 27 Jul 2025 19:50:39 -0700 Subject: [PATCH 2/6] Rename test method. --- .../AbstractClientSideOperationsTimeoutProseTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java index 1f2b052143b..02b6af360a5 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java @@ -916,7 +916,8 @@ public void shouldThrowTimeoutExceptionForSubsequentCommitTransaction() { * - When doing `minPoolSize` maintenance, `connectTimeoutMS` is used as the timeout for socket establishment. */ @Test - public void shouldUseConnectTimeoutMSWhenEstablishingConnectionInBackground() { + @DisplayName("Should use connectTimeoutMS when establishing connection in background") + public void shouldUseConnectTimeoutMsWhenEstablishingConnectionInBackground() { assumeTrue(serverVersionAtLeast(4, 4)); collectionHelper.runAdminCommand("{" @@ -929,15 +930,16 @@ public void shouldUseConnectTimeoutMSWhenEstablishingConnectionInBackground() { + " }" + "}"); - try (MongoClient mongoClient = createMongoClient(getMongoClientSettingsBuilder() + try (MongoClient ignored = createMongoClient(getMongoClientSettingsBuilder() .applyToConnectionPoolSettings(builder -> builder.minSize(1)) // Use a very short timeout to ensure that the connection establishment will fail on the first handshake command. .timeout(1, TimeUnit.MILLISECONDS))) { InternalStreamConnection.setRecordEverything(true); - // Wait for the connection to start establishment in the background + // Wait for the connection to start establishment in the background. sleep(1000); } + List commandStartedEvents = commandListener.getCommandStartedEvents("isMaster"); assertEquals(1, commandStartedEvents.size()); From 5e1b1f00e1af827b25a7e8f98fde958f88f3df32 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sat, 9 Aug 2025 23:18:18 -0700 Subject: [PATCH 3/6] Remove read timeout initialization. --- .../main/com/mongodb/internal/connection/SocketStream.java | 4 ++-- .../com/mongodb/internal/connection/SocketStreamHelper.java | 4 ++-- .../main/com/mongodb/internal/connection/SocksSocket.java | 6 +++--- .../connection/SocketStreamHelperSpecification.groovy | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java b/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java index a1c3ed0d914..6396c873ce4 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java +++ b/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java @@ -119,7 +119,7 @@ private SSLSocket initializeSslSocketOverSocksProxy(final OperationContext opera final int serverPort = address.getPort(); SocksSocket socksProxy = new SocksSocket(settings.getProxySettings()); - configureSocket(socksProxy, operationContext, settings); + configureSocket(socksProxy, settings); InetSocketAddress inetSocketAddress = toSocketAddress(serverHost, serverPort); socksProxy.connect(inetSocketAddress, operationContext.getTimeoutContext().getConnectTimeoutMs()); @@ -141,7 +141,7 @@ private static InetSocketAddress toSocketAddress(final String serverHost, final private Socket initializeSocketOverSocksProxy(final OperationContext operationContext) throws IOException { Socket createdSocket = socketFactory.createSocket(); - configureSocket(createdSocket, operationContext, settings); + configureSocket(createdSocket, settings); /* Wrap the configured socket with SocksSocket to add extra functionality. Reason for separate steps: We can't directly extend Java 11 methods within 'SocksSocket' diff --git a/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java b/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java index c919007651f..84cdf5ea7ae 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java +++ b/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java @@ -71,12 +71,12 @@ final class SocketStreamHelper { static void initialize(final OperationContext operationContext, final Socket socket, final InetSocketAddress inetSocketAddress, final SocketSettings settings, final SslSettings sslSettings) throws IOException { - configureSocket(socket, operationContext, settings); + configureSocket(socket, settings); configureSslSocket(socket, sslSettings, inetSocketAddress); socket.connect(inetSocketAddress, operationContext.getTimeoutContext().getConnectTimeoutMs()); } - static void configureSocket(final Socket socket, final OperationContext operationContext, final SocketSettings settings) throws SocketException { + static void configureSocket(final Socket socket, final SocketSettings settings) throws SocketException { socket.setTcpNoDelay(true); socket.setKeepAlive(true); // Adding keep alive options for users of Java 11+. These options will be ignored for older Java versions. diff --git a/driver-core/src/main/com/mongodb/internal/connection/SocksSocket.java b/driver-core/src/main/com/mongodb/internal/connection/SocksSocket.java index 8a0152c9423..2619a3c2c10 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/SocksSocket.java +++ b/driver-core/src/main/com/mongodb/internal/connection/SocksSocket.java @@ -81,11 +81,11 @@ public SocksSocket(@Nullable final Socket socket, final ProxySettings proxySetti } @Override - public void connect(final SocketAddress endpoint, final int timeoutMs) throws IOException { + public void connect(final SocketAddress endpoint, final int connectTimeoutMs) throws IOException { // `Socket` requires `IllegalArgumentException` - isTrueArgument("timeoutMs", timeoutMs >= 0); + isTrueArgument("connectTimeoutMs", connectTimeoutMs >= 0); try { - Timeout timeout = Timeout.expiresIn(timeoutMs, MILLISECONDS, ZERO_DURATION_MEANS_INFINITE); + Timeout timeout = Timeout.expiresIn(connectTimeoutMs, MILLISECONDS, ZERO_DURATION_MEANS_INFINITE); InetSocketAddress unresolvedAddress = (InetSocketAddress) endpoint; assertTrue(unresolvedAddress.isUnresolved()); this.remoteAddress = unresolvedAddress; diff --git a/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy b/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy index f652c2a0771..a8c9f962a4a 100644 --- a/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy +++ b/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy @@ -56,7 +56,8 @@ class SocketStreamHelperSpecification extends Specification { then: socket.getTcpNoDelay() socket.getKeepAlive() - socket.getSoTimeout() == socketSettings.getReadTimeout(MILLISECONDS) + // We set SO_TIMEOUT on each SocketStream.read(), not during initialization, so it should be 0. + socket.getSoTimeout() == 0 // If the Java 11+ extended socket options for keep alive probes are available, check those values. if (Arrays.stream(ExtendedSocketOptions.getDeclaredFields()).anyMatch{ f -> f.getName().equals('TCP_KEEPCOUNT') }) { From 82a814f926643ee8093428ddd2e1c7430d9b4714 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Sun, 10 Aug 2025 13:25:06 -0700 Subject: [PATCH 4/6] Rollback readTimeout setting and add additional prose test. --- .../internal/connection/SocketStream.java | 4 +- .../connection/SocketStreamHelper.java | 9 +++- .../SocketStreamHelperSpecification.groovy | 3 +- ...tClientSideOperationsTimeoutProseTest.java | 46 ++++++++++++++++++- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java b/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java index 6396c873ce4..a1c3ed0d914 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java +++ b/driver-core/src/main/com/mongodb/internal/connection/SocketStream.java @@ -119,7 +119,7 @@ private SSLSocket initializeSslSocketOverSocksProxy(final OperationContext opera final int serverPort = address.getPort(); SocksSocket socksProxy = new SocksSocket(settings.getProxySettings()); - configureSocket(socksProxy, settings); + configureSocket(socksProxy, operationContext, settings); InetSocketAddress inetSocketAddress = toSocketAddress(serverHost, serverPort); socksProxy.connect(inetSocketAddress, operationContext.getTimeoutContext().getConnectTimeoutMs()); @@ -141,7 +141,7 @@ private static InetSocketAddress toSocketAddress(final String serverHost, final private Socket initializeSocketOverSocksProxy(final OperationContext operationContext) throws IOException { Socket createdSocket = socketFactory.createSocket(); - configureSocket(createdSocket, settings); + configureSocket(createdSocket, operationContext, settings); /* Wrap the configured socket with SocksSocket to add extra functionality. Reason for separate steps: We can't directly extend Java 11 methods within 'SocksSocket' diff --git a/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java b/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java index 84cdf5ea7ae..74098c4ede6 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java +++ b/driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java @@ -71,14 +71,19 @@ final class SocketStreamHelper { static void initialize(final OperationContext operationContext, final Socket socket, final InetSocketAddress inetSocketAddress, final SocketSettings settings, final SslSettings sslSettings) throws IOException { - configureSocket(socket, settings); + configureSocket(socket, operationContext, settings); configureSslSocket(socket, sslSettings, inetSocketAddress); socket.connect(inetSocketAddress, operationContext.getTimeoutContext().getConnectTimeoutMs()); } - static void configureSocket(final Socket socket, final SocketSettings settings) throws SocketException { + static void configureSocket(final Socket socket, final OperationContext operationContext, final SocketSettings settings) throws SocketException { socket.setTcpNoDelay(true); socket.setKeepAlive(true); + int readTimeoutMS = (int) operationContext.getTimeoutContext().getReadTimeoutMS(); + if (readTimeoutMS > 0) { + socket.setSoTimeout(readTimeoutMS); + } + // Adding keep alive options for users of Java 11+. These options will be ignored for older Java versions. setExtendedSocketOptions(socket); diff --git a/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy b/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy index a8c9f962a4a..f652c2a0771 100644 --- a/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy +++ b/driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy @@ -56,8 +56,7 @@ class SocketStreamHelperSpecification extends Specification { then: socket.getTcpNoDelay() socket.getKeepAlive() - // We set SO_TIMEOUT on each SocketStream.read(), not during initialization, so it should be 0. - socket.getSoTimeout() == 0 + socket.getSoTimeout() == socketSettings.getReadTimeout(MILLISECONDS) // If the Java 11+ extended socket options for keep alive probes are available, check those values. if (Arrays.stream(ExtendedSocketOptions.getDeclaredFields()).anyMatch{ f -> f.getName().equals('TCP_KEEPCOUNT') }) { diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java index 02b6af360a5..a04747820f0 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java @@ -933,7 +933,7 @@ public void shouldUseConnectTimeoutMsWhenEstablishingConnectionInBackground() { try (MongoClient ignored = createMongoClient(getMongoClientSettingsBuilder() .applyToConnectionPoolSettings(builder -> builder.minSize(1)) // Use a very short timeout to ensure that the connection establishment will fail on the first handshake command. - .timeout(1, TimeUnit.MILLISECONDS))) { + .timeout(10, TimeUnit.MILLISECONDS))) { InternalStreamConnection.setRecordEverything(true); // Wait for the connection to start establishment in the background. @@ -948,6 +948,50 @@ public void shouldUseConnectTimeoutMsWhenEstablishingConnectionInBackground() { assertInstanceOf(MongoOperationTimeoutException.class, commandFailedEvents.get(0).getThrowable()); } + /** + * Not a prose spec test. However, it is additional test case for better coverage. + *

+ * From the spec: + * - When doing `minPoolSize` maintenance, `connectTimeoutMS` is used as the timeout for socket establishment. After the connection + * is established, if timeoutMS is set at the MongoClient level, it MUST be used as the timeout for all commands sent as part of + * the MongoDB or authentication handshakes + *

+ * Therefore, if timeoutMS expires before connection establishment begins, connectTimeoutMS should not be used to start a TCP connection, + * since the connection will be closed immediately on the first handshake command due to the expired timeout. The timeout MUST be + * refreshed after each command. + */ + @Test + @DisplayName("Should throw MongoOperationTimeoutException when establishing connection in background if timeoutMs expired before starting connect") + public void shouldThrowMongoOperationTimeoutWhenEstablishingConnectionInBackgroundIfTimeoutMsExpiredBeforeStartingConnect() { + assumeTrue(serverVersionAtLeast(4, 4)); + + collectionHelper.runAdminCommand("{" + + " configureFailPoint: \"failCommand\"," + + " mode: \"alwaysOn\"," + + " data: {" + + " failCommands: [\"hello\", \"isMaster\"]," + + " blockConnection: true," + + " blockTimeMS: " + 500 + + " }" + + "}"); + + TestConnectionPoolListener connectionPoolListener = new TestConnectionPoolListener(); + try (MongoClient ignored = createMongoClient(getMongoClientSettingsBuilder() + .applyToConnectionPoolSettings(builder -> builder.minSize(1)) + .applyToConnectionPoolSettings(builder -> { + builder.addConnectionPoolListener(connectionPoolListener); + }) + // Use a very short timeout to ensure that the connection establishment will fail before the first handshake command. + .timeout(1, TimeUnit.MILLISECONDS))) { + InternalStreamConnection.setRecordEverything(true); + + // Wait for the connection to start establishment in the background. + sleep(1000); + } + List commandStartedEvents = commandListener.getCommandStartedEvents("isMaster"); + assertEquals(0, commandStartedEvents.size()); + } + private static Stream test8ServerSelectionArguments() { return Stream.of( Arguments.of(Named.of("serverSelectionTimeoutMS honored if timeoutMS is not set", From 4b46b7607240243cdce1068b940e104462ceea4d Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Wed, 13 Aug 2025 12:28:54 -0700 Subject: [PATCH 5/6] Disable record everything. --- .../client/AbstractClientSideOperationsTimeoutProseTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java index a04747820f0..e68e4ee88a4 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java @@ -938,6 +938,8 @@ public void shouldUseConnectTimeoutMsWhenEstablishingConnectionInBackground() { // Wait for the connection to start establishment in the background. sleep(1000); + } finally { + InternalStreamConnection.setRecordEverything(false); } List commandStartedEvents = commandListener.getCommandStartedEvents("isMaster"); @@ -987,7 +989,10 @@ public void shouldThrowMongoOperationTimeoutWhenEstablishingConnectionInBackgrou // Wait for the connection to start establishment in the background. sleep(1000); + } finally { + InternalStreamConnection.setRecordEverything(false); } + List commandStartedEvents = commandListener.getCommandStartedEvents("isMaster"); assertEquals(0, commandStartedEvents.size()); } From 9b43b368166b23bbbf9aa4060e4dd355772dbcf6 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Wed, 13 Aug 2025 23:37:35 -0700 Subject: [PATCH 6/6] Expect only failed events. --- .../AbstractClientSideOperationsTimeoutProseTest.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java index e68e4ee88a4..c0d28db26a7 100644 --- a/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java +++ b/driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java @@ -921,8 +921,8 @@ public void shouldUseConnectTimeoutMsWhenEstablishingConnectionInBackground() { assumeTrue(serverVersionAtLeast(4, 4)); collectionHelper.runAdminCommand("{" - + " configureFailPoint: \"failCommand\"," - + " mode: \"alwaysOn\"," + + "configureFailPoint: \"" + FAIL_COMMAND_NAME + "\"," + + "mode: \"alwaysOn\"," + " data: {" + " failCommands: [\"hello\", \"isMaster\"]," + " blockConnection: true," @@ -942,9 +942,6 @@ public void shouldUseConnectTimeoutMsWhenEstablishingConnectionInBackground() { InternalStreamConnection.setRecordEverything(false); } - List commandStartedEvents = commandListener.getCommandStartedEvents("isMaster"); - assertEquals(1, commandStartedEvents.size()); - List commandFailedEvents = commandListener.getCommandFailedEvents("isMaster"); assertEquals(1, commandFailedEvents.size()); assertInstanceOf(MongoOperationTimeoutException.class, commandFailedEvents.get(0).getThrowable()); @@ -968,8 +965,8 @@ public void shouldThrowMongoOperationTimeoutWhenEstablishingConnectionInBackgrou assumeTrue(serverVersionAtLeast(4, 4)); collectionHelper.runAdminCommand("{" - + " configureFailPoint: \"failCommand\"," - + " mode: \"alwaysOn\"," + + "configureFailPoint: \"" + FAIL_COMMAND_NAME + "\"," + + "mode: \"alwaysOn\"," + " data: {" + " failCommands: [\"hello\", \"isMaster\"]," + " blockConnection: true,"