这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rahul2393
Copy link
Contributor

@rahul2393 rahul2393 commented Jul 30, 2025

Fixes: #12600

This change fixes a race condition that could occur during streaming operations in the Spanner client. The race condition was caused by concurrent access to the metrics tracer (mt) between the main execution goroutine and a background goroutine responsible for consuming stream trailers.

The fix addresses this issue by removing the wrappedStream implementation and moving the logic for updating metrics directly into the grpcSpannerClient methods (ExecuteStreamingSql, StreamingRead, and BatchWrite).

By moving the metrics-related logic out of the stream interceptor and into the gRPC client methods, the race condition is eliminated, as the metrics are now updated in the same goroutine that initiated the RPC.

@rahul2393 rahul2393 requested review from a team as code owners July 30, 2025 18:55
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Jul 30, 2025
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 30, 2025
@rahul2393 rahul2393 requested a review from olavloite July 30, 2025 18:56
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 31, 2025
olavloite
olavloite previously approved these changes Jul 31, 2025
@rahul2393 rahul2393 merged commit 88a36cd into main Jul 31, 2025
10 checks passed
@rahul2393 rahul2393 deleted the fix-issue-12600 branch July 31, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API. breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spanner: data race on mt.currOp.currAttempt

4 participants