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.
This commit is contained in:
zbilun 2025-01-13 17:57:39 -08:00 committed by GitHub
parent 228dcf7a01
commit 87b27b1545
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -1874,14 +1874,15 @@ public abstract class AbstractInteropTest {
}
long earliestNextStartNs = System.nanoTime()
+ TimeUnit.MILLISECONDS.toNanos(minTimeMsBetweenRpcs);
// recordClientCallInterceptor takes an AtomicReference.
AtomicReference<ClientCall<?, ?>> 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(