Skip to content

client: don't reuse a pick's authority override on a later attempt - #9277

Merged
easwars merged 2 commits into
grpc:masterfrom
nvxbug:attempt-authority-override
Aug 18, 2026
Merged

client: don't reuse a pick's authority override on a later attempt#9277
easwars merged 2 commits into
grpc:masterfrom
nvxbug:attempt-authority-override

Conversation

@nvxbug

@nvxbug nvxbug commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

csAttempt.newStream writes the gRFC A81 authority override from the pick result into cs.callHdr, which is allocated once per clientStream and shared by every attempt. Nothing clears Authority between attempts, so once an attempt is picked to an endpoint that carries a hostname, a retry whose own pick supplies no override still goes out with the earlier endpoint's authority. An xDS cluster using auto_host_rewrite whose endpoints do not all set hostname hits this on any retry, and :authority is what selects the virtual host and what RBAC host matchers run against on the receiving side.

Copy the call header per attempt so the override, like PreviousAttempts, stays with the attempt that produced it. The value is derived from that attempt's pick result, so the attempt is the right scope for it; leaving it on the stream lets one endpoint's rewrite outlive the pick that asked for it.

RELEASE NOTES:

  • client: Fix a bug where a retried RPC could be sent with the :authority value belonging to the endpoint chosen by an earlier attempt, when a load balancer supplies an authority override (e.g. xDS auto_host_rewrite)

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.08%. Comparing base (89d4d61) to head (ec538d8).
⚠️ Report is 28 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9277      +/-   ##
==========================================
- Coverage   83.14%   83.08%   -0.07%     
==========================================
  Files         422      423       +1     
  Lines       34862    35322     +460     
==========================================
+ Hits        28985    29346     +361     
- Misses       4385     4451      +66     
- Partials     1492     1525      +33     
Files with missing lines Coverage Δ
stream.go 82.52% <100.00%> (-0.17%) ⬇️

... and 52 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars
easwars requested a review from Pranjali-2501 August 4, 2026 03:41
@easwars easwars added this to the 1.84 Release milestone Aug 4, 2026

@Pranjali-2501 Pranjali-2501 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nvxbug , Thank you for raising a PR.

I have added some comments, PTAL.

Comment thread test/authority_override_retry_test.go Outdated
Comment thread test/authority_override_retry_test.go Outdated
Comment thread test/authority_override_retry_test.go Outdated
Comment thread test/authority_override_retry_test.go Outdated
@easwars
easwars merged commit 0ef3b0c into grpc:master Aug 18, 2026
24 checks passed
@easwars

easwars commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@nvxbug : Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants