Title: Performance [P1]: Single-flight async Azure token refresh · Issue #192 · microsoft/durabletask-python · GitHub
Open Graph Title: Performance [P1]: Single-flight async Azure token refresh · Issue #192 · microsoft/durabletask-python
X Title: Performance [P1]: Single-flight async Azure token refresh · Issue #192 · microsoft/durabletask-python
Description: What is the issue? Concurrent asynchronous RPCs can independently refresh the same expired Azure access token. What is the impact? When a token enters its refresh window, a burst of grpc.aio calls can trigger many credential requests at ...
Open Graph Description: What is the issue? Concurrent asynchronous RPCs can independently refresh the same expired Azure access token. What is the impact? When a token enters its refresh window, a burst of grpc.aio calls ...
X Description: What is the issue? Concurrent asynchronous RPCs can independently refresh the same expired Azure access token. What is the impact? When a token enters its refresh window, a burst of grpc.aio calls ...
Opengraph URL: https://github.com/microsoft/durabletask-python/issues/192
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Performance [P1]: Single-flight async Azure token refresh","articleBody":"### What is the issue?\n\nConcurrent asynchronous RPCs can independently refresh the same expired Azure access token.\n\n### What is the impact?\n\nWhen a token enters its refresh window, a burst of `grpc.aio` calls can trigger many credential requests at once. This adds latency, increases identity-provider load, and can contribute to credential throttling. The synchronous implementation already avoids this duplicate work.\n\n### Details about the issue including code reference\n\nRelevant code:\n\nhttps://github.com/microsoft/durabletask-python/blob/55d8e0b413eb5dd75afa64f30c54fe300bf4ea21/durabletask-azuremanaged/durabletask/azuremanaged/internal/access_token_manager.py#L73-L90\n\nhttps://github.com/microsoft/durabletask-python/blob/55d8e0b413eb5dd75afa64f30c54fe300bf4ea21/durabletask-azuremanaged/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.py#L114-L126\n\nhttps://github.com/microsoft/durabletask-python/blob/55d8e0b413eb5dd75afa64f30c54fe300bf4ea21/durabletask-azuremanaged/durabletask/azuremanaged/internal/access_token_manager.py#L32-L37\n\n`AsyncAccessTokenManager.get_access_token()` checks expiry and directly awaits `refresh_token()` without a lock or in-flight refresh task. `DTSAsyncDefaultClientInterceptorImpl._intercept_call()` awaits it for every RPC. In contrast, `AccessTokenManager.get_access_token()` uses double-checked locking.\n\n### A potential or proposed solution\n\nAdd an `asyncio.Lock` or shared in-flight refresh task. After entering the guard, re-check expiry before calling the credential. Keep the existing refresh window and ensure credential failures propagate to all waiting calls without deadlocking.\n\n### Cold-start relevance\n\nThe asynchronous client constructor correctly defers token acquisition, so this does not delay process construction. However, a concurrent burst of first RPCs while no token is cached has the same duplicate-acquisition behavior as refresh after expiry. The proposed single-flight guard therefore improves cold first-request latency under concurrency.\n\nRelevant code:\n\nhttps://github.com/microsoft/durabletask-python/blob/55d8e0b413eb5dd75afa64f30c54fe300bf4ea21/durabletask-azuremanaged/durabletask/azuremanaged/internal/access_token_manager.py#L63-L90","author":{"url":"https://github.com/berndverst","@type":"Person","name":"berndverst"},"datePublished":"2026-07-24T20:50:21Z","url":"https://github.com/microsoft/durabletask-python/issues/192"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5cc84efc-a345-35c1-8dcb-5e7a5fc4f62c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8088:28F0B2:15B045:1C1D4B:6AFE44AC |
| html-safe-nonce | 94b6223bf747d82e3d52d6a2073f594808f7f30e985ca375c3de124a1b4d9b09 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDg4OjI4RjBCMjoxNUIwNDU6MUMxRDRCOjZBRkU0NEFDIiwidmlzaXRvcl9pZCI6IjcwNjM0ODY0MzYzNTk0MjMxNDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 737db0d60a283e6cd2344f7008ca0c3e07d2c7c11834b6af4872324879ef2f83 |
| hovercard-subject-tag | issue:4971936636 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/durabletask-python/192/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de13f4fafa9fc9276efd07ddfe469a4ae6bd5a116da45e47524b880cf6f42695/microsoft/durabletask-python/issues/192 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de13f4fafa9fc9276efd07ddfe469a4ae6bd5a116da45e47524b880cf6f42695/microsoft/durabletask-python/issues/192 |
| og:image:alt | What is the issue? Concurrent asynchronous RPCs can independently refresh the same expired Azure access token. What is the impact? When a token enters its refresh window, a burst of grpc.aio calls ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | berndverst |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 627664515 |
| octolytics-dimension-repository_nwo | microsoft/durabletask-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627664515 |
| octolytics-dimension-repository_network_root_nwo | microsoft/durabletask-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ce393ea11ad276623b946bc9663d3e7d6f564275 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width