From 87b27b154538eaa3114c7280f02da2c4fdb0c91f Mon Sep 17 00:00:00 2001 From: zbilun Date: Mon, 13 Jan 2025 17:57:39 -0800 Subject: [PATCH] interop-testing: fix peer extraction issue in soak test iterations This PR resolves an issue with peer address extraction in the soak test. In current `TestServiceClient` implementation, the same `clientCallCapture` atomic is shared across threads, leading to incorrect peer extraction. This fix ensures that each thread uses a local variable for capturing the client call. --- .../io/grpc/testing/integration/AbstractInteropTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java b/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java index 11fe9832fd9..3f2aa048dec 100644 --- a/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java +++ b/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java @@ -1874,14 +1874,15 @@ private void executeSoakTestInThread( } long earliestNextStartNs = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(minTimeMsBetweenRpcs); - + // recordClientCallInterceptor takes an AtomicReference. + AtomicReference> soakThreadClientCallCapture = new AtomicReference<>(); currentChannel = maybeCreateChannel.apply(currentChannel); TestServiceGrpc.TestServiceBlockingStub currentStub = TestServiceGrpc .newBlockingStub(currentChannel) - .withInterceptors(recordClientCallInterceptor(clientCallCapture)); + .withInterceptors(recordClientCallInterceptor(soakThreadClientCallCapture)); SoakIterationResult result = performOneSoakIteration(currentStub, soakRequestSize, soakResponseSize); - SocketAddress peer = clientCallCapture + SocketAddress peer = soakThreadClientCallCapture .get().getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR); StringBuilder logStr = new StringBuilder( String.format(