mirror of https://github.com/grpc/grpc-java.git
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:
parent
228dcf7a01
commit
87b27b1545
|
@ -1874,14 +1874,15 @@ public abstract class AbstractInteropTest {
|
||||||
}
|
}
|
||||||
long earliestNextStartNs = System.nanoTime()
|
long earliestNextStartNs = System.nanoTime()
|
||||||
+ TimeUnit.MILLISECONDS.toNanos(minTimeMsBetweenRpcs);
|
+ TimeUnit.MILLISECONDS.toNanos(minTimeMsBetweenRpcs);
|
||||||
|
// recordClientCallInterceptor takes an AtomicReference.
|
||||||
|
AtomicReference<ClientCall<?, ?>> soakThreadClientCallCapture = new AtomicReference<>();
|
||||||
currentChannel = maybeCreateChannel.apply(currentChannel);
|
currentChannel = maybeCreateChannel.apply(currentChannel);
|
||||||
TestServiceGrpc.TestServiceBlockingStub currentStub = TestServiceGrpc
|
TestServiceGrpc.TestServiceBlockingStub currentStub = TestServiceGrpc
|
||||||
.newBlockingStub(currentChannel)
|
.newBlockingStub(currentChannel)
|
||||||
.withInterceptors(recordClientCallInterceptor(clientCallCapture));
|
.withInterceptors(recordClientCallInterceptor(soakThreadClientCallCapture));
|
||||||
SoakIterationResult result = performOneSoakIteration(currentStub,
|
SoakIterationResult result = performOneSoakIteration(currentStub,
|
||||||
soakRequestSize, soakResponseSize);
|
soakRequestSize, soakResponseSize);
|
||||||
SocketAddress peer = clientCallCapture
|
SocketAddress peer = soakThreadClientCallCapture
|
||||||
.get().getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR);
|
.get().getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR);
|
||||||
StringBuilder logStr = new StringBuilder(
|
StringBuilder logStr = new StringBuilder(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
Loading…
Reference in New Issue