Skip to content

Commit 87b27b1

Browse files
authored
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.
1 parent 228dcf7 commit 87b27b1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,14 +1874,15 @@ private void executeSoakTestInThread(
18741874
}
18751875
long earliestNextStartNs = System.nanoTime()
18761876
+ TimeUnit.MILLISECONDS.toNanos(minTimeMsBetweenRpcs);
1877-
1877+
// recordClientCallInterceptor takes an AtomicReference.
1878+
AtomicReference<ClientCall<?, ?>> soakThreadClientCallCapture = new AtomicReference<>();
18781879
currentChannel = maybeCreateChannel.apply(currentChannel);
18791880
TestServiceGrpc.TestServiceBlockingStub currentStub = TestServiceGrpc
18801881
.newBlockingStub(currentChannel)
1881-
.withInterceptors(recordClientCallInterceptor(clientCallCapture));
1882+
.withInterceptors(recordClientCallInterceptor(soakThreadClientCallCapture));
18821883
SoakIterationResult result = performOneSoakIteration(currentStub,
18831884
soakRequestSize, soakResponseSize);
1884-
SocketAddress peer = clientCallCapture
1885+
SocketAddress peer = soakThreadClientCallCapture
18851886
.get().getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR);
18861887
StringBuilder logStr = new StringBuilder(
18871888
String.format(

0 commit comments

Comments
 (0)