Announcement: Opt-in default socket timeout for the AWS SDK for PHP (2026)
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 12/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- aws, php
- Ambito
- networking
Direzione di ricerca
This is a maintainer announcement of an opt-in preview, not a defined task, so there is no change to make yet. The payload names the AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026 environment variable, the ext-curl handler, the http.curl client options, and the CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME settings. Done would mean a reported behavior question is answered or a concrete gap in the preview is identified, which needs familiarity with the SDK's HTTP layer.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The AWS SDK for PHP is making a default socket (inactivity) timeout available as an opt-in preview. This change applies only to the cURL HTTP handler (ext-curl). It is built on libcurl's low-speed options, which have no equivalent on the SDK's stream-wrapper transport, so an environment without ext-curl is unaffected. If you do not enable the preview, existing applications behave as they do today. We intend to make this behavior the default in the future.
Status
| Applies to | The cURL HTTP handler only (ext-curl). The stream-wrapper transport is unaffected. |
| Opt-in available in | 3.400.0 and later |
| Opt-in flag | Environment variable AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026=true |
Why
A connection can be established successfully and then stop delivering data. Without a socket timeout, such a request waits until the OS gives up, unless the application configured its own timeout. This preview adds a per-service default that closes that gap on the cURL handler.
The default is a rolling inactivity window, not a deadline on the complete operation. It is implemented with libcurl's low-speed options: a fixed floor of 1 byte/second (CURLOPT_LOW_SPEED_LIMIT) combined with a per-service time (CURLOPT_LOW_SPEED_TIME). Any byte transferred in either direction keeps the transfer alive, so a slow response that continues making progress is not interrupted; the window trips only on genuine silence. A single window covers both read and write, since libcurl watches both directions.
The timeout is selected by service:
| Service category | Default timeout |
|---|---|
| Most services | 5 minutes |
| Services with long-hold operations | 15 minutes |
| Services with streaming or long-lived connections (exempt) | No default |
The exempt category covers APIs that legitimately hold a connection open without transferring data, including streaming request/response bodies and bidirectional streams. Exempt services receive no socket timeout even with the preview enabled. Applications can override any of these defaults per client.
Will this affect me?
Not unless you opt in. During the preview, leaving the opt-in setting disabled preserves the SDK's current behavior. The change is limited to the cURL handler, and any cURL options you set yourself take precedence over the service default. If you already set the cURL low-speed options on a client, the SDK leaves them untouched.
When the window elapses with no read or write progress, cURL aborts the transfer and the in-flight request fails with a cURL error, which is retried per the client's configured retry policy.
Opt in
Set the following environment variable before running your application:
export AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026=true
The gate is matched exactly against the string true. Any other value, including 1, TRUE, an empty string, or unset, counts as off.
To stop using the preview, set the flag to anything other than true, or remove it, then restart the application:
export AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026=false
# or remove it entirely:
unset AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026
No code change is required. With the preview enabled, every service client built on the cURL handler receives its service-specific default automatically. The example uses S3Client, but the same applies to every service client:
<?php
// Opt in via AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026=true
use Aws\S3\S3Client;
$s3 = new S3Client([
'region' => 'us-east-1',
'version' => 'latest',
]);
Override or opt out for a specific client
The preview flag turns the service default on globally, but you can override it or opt out for an individual client, whether or not the preview is enabled. The SDK applies its default only when you have not set either cURL low-speed option yourself; set either one and you own the pair, and the SDK attaches nothing.
Use a different timeout. Set the cURL low-speed options explicitly through the client's http.curl options. They always take precedence over the service default. Keep CURLOPT_LOW_SPEED_LIMIT at 1 to express a pure read/write inactivity window, and set CURLOPT_LOW_SPEED_TIME to your chosen number of seconds:
<?php
use Aws\S3\S3Client;
$s3 = new S3Client([
'region' => 'us-east-1',
'version' => 'latest',
'http' => [
'curl' => [
CURLOPT_LOW_SPEED_LIMIT => 1,
CURLOPT_LOW_SPEED_TIME => 30, // seconds of inactivity
],
],
]);
Opt a client out entirely. Setting either low-speed option disables the SDK default for that client. To opt out without imposing any inactivity window, set the time to 0 (cURL treats 0 as no low-speed abort):
<?php
use Aws\S3\S3Client;
$s3 = new S3Client([
'region' => 'us-east-1',
'version' => 'latest',
'http' => [
'curl' => [
CURLOPT_LOW_SPEED_LIMIT => 1,
CURLOPT_LOW_SPEED_TIME => 0, // no inactivity timeout
],
],
]);
Feedback
If you encounter unexpected behavior or have questions, comment on this issue. Please include the SDK version, service client, operation, whether ext-curl is in use, and whether you set any cURL options or timeout explicitly. Your feedback during the opt-in period will help determine when and how we make this the default.
- Lingua principale
- PHP
- Stelle
- 6.2k
- Fork
- 1.3k
- Merge medio
- 2g 7h
- PR unite (30g)
- 11
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/aws-sdk-php
-
feature-request needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws/aws-sdk-php#3365 ·
I maintainer di solito rispondono entro 2 giorni
-
Event stream decoder drops the final event when reading it reaches EOFForse già presa @lazerg l’ha presa oggi. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
aws/aws-sdk-php#3374 ·
I maintainer di solito rispondono entro 2 giorni
-
Event stream decoder reports a checksum mismatch when the checksum is read in partsForse già presa @lazerg l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
aws/aws-sdk-php#3371 ·
I maintainer di solito rispondono entro 2 giorni
-
AssumeRoleCredentialProvider replaces non-RuntimeException failures with TypeErrorForse già presa @lazerg l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
aws/aws-sdk-php#3370 ·
I maintainer di solito rispondono entro 2 giorni
-
bug needs-triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
aws/aws-sdk-php#3364 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di aws/aws-sdk-php
Issue simili
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 4 giorni
-
feature request
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Automattic/blocks-engine#2803 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
hestiacp/hestiacp#5798 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Component: HTTP Component: Telemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100