René's URL Explorer Experiment


Title: Performance [P2]: Reuse sandbox registration transport on retries by berndverst · Pull Request #206 · microsoft/durabletask-python · GitHub

Open Graph Title: Performance [P2]: Reuse sandbox registration transport on retries by berndverst · Pull Request #206 · microsoft/durabletask-python

X Title: Performance [P2]: Reuse sandbox registration transport on retries by berndverst · Pull Request #206 · microsoft/durabletask-python

Description: Summary SandboxWorker._run_sandbox_registration_loop() constructed a brand new SandboxActivitiesGrpcTransport on every retry attempt. Each construction created a new gRPC channel, a new stub, and a new DTSDefaultClientInterceptorImpl, which in turn acquires an Entra token in its constructor. A transient registration failure therefore cost a full channel setup plus a token acquisition per retry, amplifying startup and recovery latency exactly when the service was already degraded. The registration loop now builds the transport once and reuses it across retriable stream failures, closing it once when the loop exits so channels are not leaked. What changed durabletask-azuremanaged/durabletask/azuremanaged/preview/sandboxes/worker.py The transport is created lazily on the first attempt and reused for subsequent attempts, including the reconnect path where the server ends the registration stream while the worker is still running. Added _requires_new_registration_transport(), which replaces the transport only when a failure leaves the channel unusable: a channel that has been shut down (CANCELLED with Channel closed!) or any non-gRPC failure, such as an error raised while the channel itself is being created. gRPC channels reconnect on their own after transient RPC failures, so those reuse the existing transport. Added _close_sandbox_registration_transport(), which closes the transport defensively and is invoked from a finally block covering the whole loop. Everything else is unchanged: the exponential backoff schedule, responsiveness to the stop signal, thread join semantics, log messages, and the exception types and terminal handling for non-retriable failures. No public API, signature, import path, or observable behavior changes, so per the repository changelog policy this internal performance fix does not get a changelog entry. Verification New tests in tests/durabletask-azuremanaged/test_sandboxes_extension.py: test_sandbox_registration_reuses_one_transport_across_retriable_failures uses a fake transport factory to assert that 3 retriable UNAVAILABLE failures result in exactly 1 transport construction and 1 close, and that the backoff windows are still 1.0, 2.0, 4.0. test_sandbox_registration_rebuilds_transport_after_channel_shutdown asserts a shut-down channel still produces a replacement transport, and that the discarded transport is closed. test_sandbox_registration_loop_exits_promptly_on_stop_signal runs the loop on a thread and asserts it exits promptly once the stop event is set, with the transport closed exactly once. test_sandbox_registration_recreates_transport_only_when_channel_is_unusable covers the reuse-versus-replace predicate directly. The reuse test fails against the pre-fix implementation (4 transports instead of 1), confirming it guards the regression. pytest tests/durabletask-azuremanaged/test_sandboxes_extension.py tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.py -q -> 46 passed (42 before, plus the 4 new tests). pytest tests/durabletask -q --ignore-glob="*_e2e.py" -> 681 passed, 7 skipped. flake8 clean on both changed files. pyright reports 0 errors for the changed source file under the repository's strict configuration. Out of scope The issue's cold-start note about sharing channel or authentication state with the parent DurableTaskSchedulerWorker is intentionally not addressed here; it overlaps with the deferred token acquisition work tracked in #187. Fixes #188

Open Graph Description: Summary SandboxWorker._run_sandbox_registration_loop() constructed a brand new SandboxActivitiesGrpcTransport on every retry attempt. Each construction created a new gRPC channel, a new stub, and a...

X Description: Summary SandboxWorker._run_sandbox_registration_loop() constructed a brand new SandboxActivitiesGrpcTransport on every retry attempt. Each construction created a new gRPC channel, a new stub, and a...

Opengraph URL: https://github.com/microsoft/durabletask-python/pull/206

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b6718c9d-0af9-8b21-56cc-fc6f05b5e2ea
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id83BE:22A512:D73CA:120F62:6AFE44BA
html-safe-nonce407374f78b12d6bfd0d7fa6ecdbb435ae4086224eba752512742b6736d14607e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0JFOjIyQTUxMjpENzNDQToxMjBGNjI6NkFGRTQ0QkEiLCJ2aXNpdG9yX2lkIjoiNTY3ODkyMzA3MzMwMjk3MTU3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0f13328935f237faf3b18e49a1314c8add3e178b8fb62e8f1049204ac299fe3c
hovercard-subject-tagpull_request:4139791292
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/durabletask-python/pull/206/files
twitter:imagehttps://avatars.githubusercontent.com/u/4535280?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4535280?s=400&v=4
og:image:altSummary SandboxWorker._run_sandbox_registration_loop() constructed a brand new SandboxActivitiesGrpcTransport on every retry attempt. Each construction created a new gRPC channel, a new stub, and a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonef1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id627664515
octolytics-dimension-repository_nwomicrosoft/durabletask-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627664515
octolytics-dimension-repository_network_root_nwomicrosoft/durabletask-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasece393ea11ad276623b946bc9663d3e7d6f564275
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/pull/206/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F206%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F206%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2Fdurabletask-python
Reloadhttps://github.com/microsoft/durabletask-python/pull/206/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/206/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/206/files
microsofthttps://github.com/microsoft
durabletask-pythonhttps://github.com/microsoft/durabletask-python
Codehttps://github.com/microsoft/durabletask-python
Issues15 (15)https://github.com/microsoft/durabletask-python/issues
Pull requests12 (12)https://github.com/microsoft/durabletask-python/pulls
Actionshttps://github.com/microsoft/durabletask-python/actions
Projectshttps://github.com/microsoft/durabletask-python/projects
Security and qualityhttps://github.com/microsoft/durabletask-python/security
Insightshttps://github.com/microsoft/durabletask-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
Bernd Verst (berndverst)https://github.com/berndverst
mainhttps://github.com/microsoft/durabletask-python/tree/main
berndverst-reuse-sandbox-registration-transporthttps://github.com/microsoft/durabletask-python/tree/berndverst-reuse-sandbox-registration-transport
Conversation 4 https://github.com/microsoft/durabletask-python/pull/206
Commits 3 https://github.com/microsoft/durabletask-python/pull/206/commits
Checks 24 https://github.com/microsoft/durabletask-python/pull/206/checks
Files changed https://github.com/microsoft/durabletask-python/pull/206/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/206/files
Performance [P2]: Reuse sandbox registration transport on retries https://github.com/microsoft/durabletask-python/pull/206/files#top
Show all changes 3 commits https://github.com/microsoft/durabletask-python/pull/206/files
9cc01a8 Reuse sandbox registration transport across retries Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/206/commits/9cc01a88d86bdf3bd8974246c58603f0c66a6984
963f5f5 Merge remote-tracking branch 'origin/main' into berndverst-reuse-sand… Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/206/commits/963f5f557dac39f6be32b468daea13b32ae206e1
f9753b7 Compare gRPC status codes with != for consistency Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/206/commits/f9753b74c9cbd1d949b9382d8b148cf6f659e544
Clear filters https://github.com/microsoft/durabletask-python/pull/206/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/206/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/206/files
worker.py https://github.com/microsoft/durabletask-python/pull/206/files#diff-4612edd87bce0bacb589bf68f373ff5fc1e707bf9f367798699350d8b506dbff
test_sandboxes_extension.py https://github.com/microsoft/durabletask-python/pull/206/files#diff-1623484725e2c99a6166e35b1c3de34ecfad701e2fe111b36461ea0535ef6d5d
durabletask-azuremanaged/durabletask/azuremanaged/preview/sandboxes/worker.pyhttps://github.com/microsoft/durabletask-python/pull/206/files#diff-4612edd87bce0bacb589bf68f373ff5fc1e707bf9f367798699350d8b506dbff
View file https://github.com/microsoft/durabletask-python/blob/f9753b74c9cbd1d949b9382d8b148cf6f659e544/durabletask-azuremanaged/durabletask/azuremanaged/preview/sandboxes/worker.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/206/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/206/files#diff-4612edd87bce0bacb589bf68f373ff5fc1e707bf9f367798699350d8b506dbff
https://github.com/microsoft/durabletask-python/pull/206/files#diff-4612edd87bce0bacb589bf68f373ff5fc1e707bf9f367798699350d8b506dbff
https://github.com/microsoft/durabletask-python/pull/206/files#diff-4612edd87bce0bacb589bf68f373ff5fc1e707bf9f367798699350d8b506dbff
https://github.com/microsoft/durabletask-python/pull/206/files#diff-4612edd87bce0bacb589bf68f373ff5fc1e707bf9f367798699350d8b506dbff
tests/durabletask-azuremanaged/test_sandboxes_extension.pyhttps://github.com/microsoft/durabletask-python/pull/206/files#diff-1623484725e2c99a6166e35b1c3de34ecfad701e2fe111b36461ea0535ef6d5d
View file https://github.com/microsoft/durabletask-python/blob/f9753b74c9cbd1d949b9382d8b148cf6f659e544/tests/durabletask-azuremanaged/test_sandboxes_extension.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/206/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/206/files#diff-1623484725e2c99a6166e35b1c3de34ecfad701e2fe111b36461ea0535ef6d5d
https://github.com/microsoft/durabletask-python/pull/206/files#diff-1623484725e2c99a6166e35b1c3de34ecfad701e2fe111b36461ea0535ef6d5d
https://github.com/microsoft/durabletask-python/pull/206/files#diff-1623484725e2c99a6166e35b1c3de34ecfad701e2fe111b36461ea0535ef6d5d
https://github.com/microsoft/durabletask-python/pull/206/files#diff-1623484725e2c99a6166e35b1c3de34ecfad701e2fe111b36461ea0535ef6d5d
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/206/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.