Repository navigation
Replies: 1 comment
Update: The updated retry behavior is now the defaultStarting in What this means for you
Restoring previous behavior In export AWS_RETRY_MODE=legacyIn We've updated the description with the new version information and revert instructions, and corrected some of the before-and-after values. If you run into unexpected behavior, comment here. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Important
Update: Starting in
aws-sdk-phpversion3.403.3(released November 10, 2026), the updated retry behavior is the default and theAWS_NEW_RETRIES_2026environment variable is removed. To test the updated behavior before you upgrade, see How to opt in early. To restore previous behavior after you upgrade, see How to revert.Status
aws-sdk-phpversion3.401.1and laterAWS_NEW_RETRIES_2026=true(removed in version3.403.3)aws-sdk-phpversion3.403.3and later (released November 10, 2026)What changed
Starting in version
3.403.3(or earlier, if you setAWS_NEW_RETRIES_2026=true), the default retry mode changes fromlegacytostandard. Several other retry defaults also update. Thestandardmode adds a retry quota that limits retries when failures are widespread, so your application fails fast instead of waiting on retries that are unlikely to succeed. This also helps service disruptions resolve faster by reducing retry traffic.If you have explicitly configured a retry mode or max attempts, your value takes precedence for that setting. However, a
retriesarray in code replaces both settings from environment variables and the config file. For example, with'retries' => ['mode' => 'standard'], the client uses the default max attempts (3, or 4 for DynamoDB and DynamoDB Streams), even if you setAWS_MAX_ATTEMPTS. If you usestandardoradaptivemode, the new backoff timing, retry quota costs, and DynamoDB max attempts still apply.DynamoDB and DynamoDB Streams clients now read
AWS_RETRY_MODE,AWS_MAX_ATTEMPTS, and the config file, which they previously ignored. Adefaults_modeother thanlegacyno longer overrides your retry mode or max attempts.legacystandardTransient errors (such as 500s and connection resets) now use a much shorter backoff than throttling errors (where the service asks you to slow down). For details on backoff timing, error classification, and the retry quota, see Retry behavior in the AWS SDKs. For retry mode selection and configuration options, see Retry behavior in the AWS SDKs.
How to opt in early
Update to
aws-sdk-phpversion3.401.1or later, then set the environment variable:export AWS_NEW_RETRIES_2026=trueThe value must be exactly
true(lowercase). The opt-in matches the new default, except that it doesn't retry HTTP 429 responses with an unrecognized error code, and adefaults_modeother thanlegacystill overrides your retry mode.In version
3.403.3and later, the updated behavior is the default and the SDK ignoresAWS_NEW_RETRIES_2026. You can remove it from your configuration after you upgrade.How to revert
In versions earlier than
3.403.3, remove the environment variable:unset AWS_NEW_RETRIES_2026In version
3.403.3and later, the updated behavior is the default and the SDK ignoresAWS_NEW_RETRIES_2026, so unsetting it or setting it tofalsedoesn't restore the previous behavior. To restore previous behavior, set the retry mode tolegacy:export AWS_RETRY_MODE=legacyOr in code:
With
legacymode, DynamoDB and DynamoDB Streams clients now also readAWS_MAX_ATTEMPTSandmax_attemptsfrom the config file, which they previously ignored. Without either, they use 11 max attempts. DynamoDB Streams previously used 12, so to keep 12, setAWS_MAX_ATTEMPTS=12or'retries' => ['mode' => 'legacy', 'max_attempts' => 12].If you previously used
standardoradaptivemode, or adefaults_modeother thanlegacy,legacydoesn't restore your previous behavior, because the updated implementation replaces the previousstandardmode.Where you might notice a difference
Most transient retries wait less. DynamoDB's first retry, previously immediate, now waits up to 25 ms. Throttling retries wait longer: up to 1,000 ms on the first retry, previously 100 ms (immediate for DynamoDB).
max_attemptsto restore your previous value.AWS_MAX_ATTEMPTSormax_attemptsfor other clients, DynamoDB and DynamoDB Streams clients now use it too.legacymode for DynamoDB. If you set'mode' => 'legacy'for a DynamoDB or DynamoDB Streams client without settingmax_attempts, max attempts increase from 3 to 11.standardmode, previously 5, or 10 for connection errors). Unlike the previous standard mode, whose quota reset on every request (except for Amazon S3 clients), the quota is now shared per client. Throttling retries cost 5 tokens.ReceiveMessage, Step FunctionsGetActivityTask, and SWFPollForActivityTaskandPollForDecisionTaskapply a backoff delay before returning an error, even when retries are blocked. Without this, a polling loop would send its next request immediately after each error, spiking client CPU usage and generating additional traffic. The delay blocks the PHP process, so it also holds up other asynchronous requests in flight. For details, see long-polling operations.legacymode, the default now also retriesRequestTimeout,RequestTimeoutException,PriorRequestNotComplete, andLimitExceededExceptionerrors, errors that the service model marks as retryable, and HTTP 429 responses with an unrecognized error code. DynamoDBTransactionInProgressExceptionerrors count as throttling errors.x-amz-retry-afterresponse header. When a service sends it, the SDK waits at least its own computed backoff and at most 5 seconds longer.Overriding specific settings
You do not have to accept all changes as a bundle. You can keep a previous retry mode or max attempts by setting it explicitly. Precedence applies per setting across environment variables and the config file. In code, a
retriesarray must includemode.['max_attempts' => 11]alone throws anInvalidArgumentException. An integer such as'retries' => 10is accepted, but it selectslegacymode with that many retries.For example, to use the new backoff timing but keep a higher DynamoDB max attempts:
The retry quota still applies. During widespread transient failures, a client stops retrying after about 35 retries in total, whatever
max_attemptsis, until successful requests refill the quota.For the full list of configurable settings and their precedence, see Retry behavior in the AWS SDKs.
Feedback
If you encounter unexpected behavior or have questions, comment on this issue. If you need a previous value that you can't configure, let us know here.
All reactions