Repository navigation
Default RetryPolicy max_retry_interval and prevent capped backoff overflow - #370
Open
andystaples wants to merge 5 commits into
Open
andystaples wants to merge 5 commits into
andystaples wants to merge 5 commits into
Conversation
…rflow RetryPolicy.max_retry_interval now defaults to one hour or first_retry_interval, whichever is longer; passing None keeps uncapped delays. Backoff calculations that overflow now saturate at the configured cap instead of failing the orchestration with OverflowError. Fixes #367 Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Replay compatibility after the retry-cap default change remains untested, and the upgrade warning overstates which recorded timer histories will fail.
2 open issues
What changed in this PR
Addresses #367 by preventing capped retry backoff from failing on power overflow and introducing a bounded default for retry delays in the core SDK.
Changes:
- Defaults
max_retry_intervalto one hour or the first retry interval, whichever is longer; explicitNoneremains uncapped. - Handles exponential-backoff overflow and adds focused regression tests.
- Documents the new default, replay risks, and upgrade guidance across all three packages.
| File | Description |
|---|---|
tests/durabletask/test_retry_backoff.py |
Tests default caps, uncapped delays, and overflow handling. |
durabletask/task.py |
Implements the default cap and overflow handling. |
durabletask-azuremanaged/CHANGELOG.md |
Documents Managed provider behavior and upgrade implications. |
docs/features.md |
Explains the retry cap default and opt-out. |
CHANGELOG.md |
Records core behavior changes and replay warnings. |
azure-functions-durable/CHANGELOG.md |
Documents Functions provider behavior and replay risks. |
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
…-max-interval' into andystaples-retry-policy-default-max-interval # Conflicts: # CHANGELOG.md
Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #367
Summary
RetryableTask.compute_next_delay()evaluatedmath.pow(coefficient, attempt - 1)before applyingmax_retry_interval, so a capped policy could still fail the orchestration withOverflowErroronce the unused power overflowed. An overflowing power now saturates and the configured cap applies.RetryPolicy.max_retry_intervalnow defaults to one hour orfirst_retry_interval, whichever is longer, instead of unbounded. Passingmax_retry_interval=Noneexplicitly keeps uncapped delays. Taking the longer of the two means a policy with a long constant interval (for example, 6-hour retries) is never shortened by the new default.Cross-SDK alignment
Math.Pow→Infinity, compared against capMath.pow→Infinity,Math.mincapsArithmeticException, returns cap.NET silently caps a first interval longer than one hour, and JS rejects such policies at construction. This PR instead never shortens the configured first interval.
Compatibility
Changing the default can affect in-flight retries whose policy omits
max_retry_intervaland whose next delay already exceeds the new cap:maximum_timer_interval(three days by default onTaskHubGrpcWorkerand the Functions worker) are split into multiple timers. When the capped delay needs fewer parts than were recorded, the retry runs early after its last part fires, or replay fails withNonDeterminismErrorif an extra part was already recorded.DurableTaskSchedulerWorkernever splits timers, so it is not exposed to theNonDeterminismErrorcase. Functions apps split timers regardless of storage backend, including when using Durable Task Scheduler.The changelogs call this out and recommend draining affected instances, or setting
max_retry_interval=Noneon those policies before upgrading.Histories that previously ended with the
OverflowErrorare terminal failures, so the overflow fix has no in-flight replay impact.Release coordination
The Azure Managed and Functions changelogs describe the behavior with the corresponding core update; version and dependency minimum bumps belong in the release PR.