Azure / Azure/azure-sdk-for-cpp
[EventHubs] Harden CBS token refresh retry and recovery
- Dominant language
- C++
- Stars
- 205
- Forks
- 172
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 37
Description
## Summary
The proactive CBS token refresh added by #7308 keeps long-lived Event Hubs clients authorized, but its recovery behavior still has several gaps. Refresh attempts use one fixed connection-wide cadence, refresh failures lose their structure, one slow audience can delay another, and an authorization failure can require a second user operation before a rebuilt connection succeeds.
This issue tracks the follow-up work that makes CBS refresh and foreground recovery bounded, failure-aware, and deterministic. Rust AMQP parity is outside this workstream.
## Scope
- [ ] #7376
- [ ] #7378
- [ ] #7379
- [ ] #7377
The implementation remains internal. Any public configuration or API change requires a separate API review.
Issue #7330 covers the related low-level ambiguity where `PutTokenForAudience` raises `AuthenticationException` for every non-`Ok` CBS result. Issue #7379 preserves the classified result through the refresh scheduler without adding Rust parity to this workstream.
## Completion criteria
- [ ] Every linked sub-issue is complete.
- [ ] A transient CBS refresh failure can recover before the current authorization expires.
- [ ] A stale authorization can rebuild once within the same send or receive operation.
- [ ] A permanent credential failure remains bounded and preserves its actionable error.
- [ ] Retry and recovery waits honor `Azure::Core::Context` cancellation.
- [ ] Deterministic offline tests cover retry success, retry exhaustion, cancellation, and multiple audiences.
This work changes authentication behavior and requires explicit security-focused review.
Contributor guide
Research direction
Start by reading linked sub-issues #7376, #7378, #7379, and #7377, then inspect the proactive CBS refresh work from #7308 and the Azure::Core::Context cancellation path. Done means bounded, cancellation-aware retry and recovery with deterministic offline tests for success, exhaustion, cancellation, and multiple audiences, while preserving actionable permanent credential errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, cpp
- Domain
- backend, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100