Skip to content

xds: fix TSAN data races in xDS security components and tests#12829

Merged
kannanjgithub merged 1 commit into
grpc:masterfrom
kannanjgithub:tsan-race-cert-provider-fix
May 27, 2026
Merged

xds: fix TSAN data races in xDS security components and tests#12829
kannanjgithub merged 1 commit into
grpc:masterfrom
kannanjgithub:tsan-race-cert-provider-fix

Conversation

@kannanjgithub
Copy link
Copy Markdown
Contributor

This change resolves several data races reported by ThreadSanitizer (TSAN) in XdsSecurityClientServerTest and associated xDS security components.

Key changes:

  • Made certificate, key storage, and SSL context fields volatile in CertProviderSslContextProvider and DynamicSslContextProvider to ensure safe publication between Netty EventLoop threads and background FileWatcher threads.
  • Made experimental static flags (enableSpiffe and useChannelAuthorityIfNoSniApplicable) volatile. These flags are toggled by tests while being read by background networking threads; making them volatile ensures these transitions are thread-safe and TSAN-compliant.

b/514777926

@kannanjgithub kannanjgithub requested a review from shivaspeaks May 27, 2026 03:56
This change resolves several data races reported by ThreadSanitizer (TSAN)
in XdsSecurityClientServerTest and associated xDS security components.

Key changes:
- Made certificate, key storage, and SSL context fields volatile in
  CertProviderSslContextProvider and DynamicSslContextProvider to ensure
  safe publication between Netty EventLoop threads and background
  FileWatcher threads.
- Made experimental static flags (enableSpiffe and
  useChannelAuthorityIfNoSniApplicable) volatile. These flags are toggled
  by tests while being read by background networking threads; making them
  volatile ensures these transitions are thread-safe and TSAN-compliant.
@kannanjgithub kannanjgithub force-pushed the tsan-race-cert-provider-fix branch 2 times, most recently from be5e50c to d629d99 Compare May 27, 2026 04:56
@kannanjgithub kannanjgithub merged commit 6faedad into grpc:master May 27, 2026
24 of 26 checks passed
@kannanjgithub kannanjgithub deleted the tsan-race-cert-provider-fix branch May 27, 2026 06:25
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.

2 participants