Skip to content

xds: Fix concurrent StreamObserver usage in ExternalProcessorClientInterceptorTest - #12915

Merged
kannanjgithub merged 1 commit into
grpc:masterfrom
kannanjgithub:tsan-ext-proc-tests
Jul 29, 2026
Merged

kannanjgithub merged 1 commit into
grpc:masterfrom
kannanjgithub:tsan-ext-proc-tests

Conversation

@kannanjgithub

@kannanjgithub kannanjgithub commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Synchronize calls to the gRPC StreamObserver (responseObserver) inside mock ExternalProcessor implementations. The mock servers in several tests spawn background threads to handle requests, but they invoke responseObserver.onNext(), onCompleted(), and onError() concurrently without synchronization. Since standard StreamObservers are not thread-safe, this leads to ThreadSanitizer-reported data races in gRPC internals (such as ServerCallImpl).

This change wraps all asynchronous/background invocations of responseObserver methods inside synchronized blocks on the observer instance to ensure serialized execution.

Flagged by TSAN in b/533413322

…terceptorTest

Synchronize calls to the gRPC StreamObserver (responseObserver) inside mock
ExternalProcessor implementations. The mock servers in several tests spawn background
threads to handle requests, but they invoke responseObserver.onNext(), onCompleted(),
and onError() concurrently without synchronization. Since standard StreamObservers
are not thread-safe, this leads to ThreadSanitizer-reported data races in gRPC
internals (such as ServerCallImpl).

This change wraps all asynchronous/background invocations of responseObserver
methods inside synchronized blocks on the observer instance to ensure serialized execution.
@kannanjgithub kannanjgithub added the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Jul 28, 2026
@grpc-kokoro grpc-kokoro removed the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Jul 28, 2026
@kannanjgithub
kannanjgithub merged commit d54c8c9 into grpc:master Jul 29, 2026
18 checks passed
@kannanjgithub
kannanjgithub deleted the tsan-ext-proc-tests branch July 29, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants