Skip to content

xds: Fix concurrent StreamObserver usage in ExternalProcessorClientInterceptorTest#12915

Open
kannanjgithub wants to merge 1 commit into
grpc:masterfrom
kannanjgithub:tsan-ext-proc-tests
Open

xds: Fix concurrent StreamObserver usage in ExternalProcessorClientInterceptorTest#12915
kannanjgithub wants to merge 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.
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.

1 participant