Skip to content

[DO NOT MERGE] [Default Read/Write Timeout] Merge feature branch: SDK-managed default read/write timeout for CRT-based HTTP clients (off by default) - #7336

Open
zoewangg wants to merge 7 commits into
masterfrom
feature/master/2026-enable-default-read-timeout
Open

[DO NOT MERGE] [Default Read/Write Timeout] Merge feature branch: SDK-managed default read/write timeout for CRT-based HTTP clients (off by default)#7336
zoewangg wants to merge 7 commits into
masterfrom
feature/master/2026-enable-default-read-timeout

Conversation

@zoewangg

@zoewangg zoewangg commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Merges the feature/master/2026-enable-default-read-timeout feature branch into master. This adds an SDK-managed default read/write (socket) inactivity timeout for HTTP clients that do not enforce one of their own — currently only the AWS CRT-based clients (AwsCrtHttpClient / AwsCrtAsyncHttpClient). Apache and Netty already apply their own read/write timeouts and are unaffected.

The behavior is off by default and gated behind an opt-in flag: the AWS_ENABLE_DEFAULT_SOCKET_TIMEOUT_2026 environment variable / aws.enableDefaultSocketTimeout2026 system property. Upgrading changes no behavior unless a customer explicitly opts in.

When enabled, the SDK resolves a per-service timeout and applies it to the CRT client, which shuts down a connection that transfers no bytes in either direction for the resolved window, failing the in-flight request with a retryable IOException.

Constituent PRs

This feature was developed and reviewed incrementally on the feature branch. This PR is the aggregate merge of the following already-reviewed-and-merged PRs:

Related (already merged directly to master): #7348 — adds the no-op defaultEnableSocketTimeout2026 codegen customization-config field.

Key behavior

  • Off by default; opt-in via env var / system property.
  • CRT-only. Honored only by the CRT-based HTTP clients; Apache and Netty enforce their own read/write timeouts and ignore it.
  • SDK-managed clients only. Applied only to a CRT client the SDK builds and manages; a directly-supplied/standalone CRT client is left untouched, and an explicit connectionHealthConfiguration always takes precedence.
  • Per-service tiers. Fully-exempt services get no timeout; partial-tier services get a longer window (15 min); all other (unlisted) services get the general 5-minute default.
  • CRT mapping. A positive timeout maps to a CRT throughput monitor at 1 byte/sec over an interval of the timeout (whole-second granularity, 2-second minimum).

Public API

No new public API. The CRT connectionHealthConfiguration(...) methods are unchanged in signature; only their Javadoc was reframed to document the read/write inactivity timeout behavior.

Testing

Covered by the constituent PRs: rollout-gate resolver precedence, CRT timeout mapping and explicit-config-precedence, and CRT long-running-request tests.

Reviewer note

Each change above was reviewed individually; this PR is for a holistic review of the combined feature before it merges to master.

Mirror the AWS_NEW_RETRIES_2026 gate: add the
AWS_ENABLE_DEFAULT_READ_TIMEOUT_2026 system setting, its resolver, the
DEFAULT_ENABLE_READ_TIMEOUT_2026 client option, and the codegen
customization field that bakes it into mergeInternalDefaults. Nothing
consumes the gate yet; the aws-core and CRT client wiring follow
separately.
The CRT-based HTTP clients now honor
SDK_INTERNAL_FALLBACK_READ_WRITE_TIMEOUT, mapping it onto an
HttpMonitoringOptions minimum-throughput monitor. An explicit
ConnectionHealthConfiguration takes precedence; a standalone client
reads the opt-in environment variable directly.
Codegen bakes each listed service's default read/write timeout
tier into its generated serviceHttpConfig from a checked-in
exemption artifact; aws-core applies the rollout gate to the
baked value.
… to SDK-managed clients (#7334)

* fix: scope CRT default timeout to managed clients

A directly-supplied CRT client is caller-owned (buildWithDefaults is
not called on it) and is often shared across services with different
exemption tiers, so applying a flat default could break an exempt
service. The client no longer reads the opt-in setting itself; the
default now applies only to SDK-managed clients, via the option
resolved in aws-core.

* docs: clarify CRT default timeout scope in Javadoc

Document that the CRT builder's connectionHealthConfiguration applies
an automatic default only for SDK-managed clients; a directly-supplied
or standalone client gets no default and honors only an explicit
configuration.
@zoewangg
zoewangg requested a review from a team as a code owner August 31, 2026 21:39
Rename the interim rollout-gate symbols (system setting, env var,
property, resolver, client option, codegen customization) from the
READ name to the cross-SDK-settled SOCKET name. Behavior-preserving.
SDK_INTERNAL_FALLBACK_READ_WRITE_TIMEOUT is intentionally not renamed;
it names the read+write mechanism value, not the gate.
@zoewangg zoewangg changed the title [DO NOT MERGE] Enable default read timeout [DO NOT MERGE] [Default Read/Write Timeout] Merge feature branch: SDK-managed default read/write timeout for CRT-based HTTP clients (off by default) Sep 3, 2026
@zoewangg
zoewangg requested a review from alextwoods September 3, 2026 23:03
*
* <p>
* Disabled by default.
* <p>When this client is created and managed by an AWS SDK service client, a default read/write inactivity timeout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One weird case I'm thinking through - if a customer shares a http client builder and supplies it across multiple services, each will end up getting its own, seperate socket timeouts applies (since we consider the customer supplied builder still an SDK managed instance). I don't think thats incorrect, but it might be slightly confusing. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, pushed a commit to update the doc 2061611

alextwoods
alextwoods previously approved these changes Sep 4, 2026
@zoewangg
zoewangg dismissed alextwoods’s stale review September 4, 2026 17:01

Dismissing the review since we are not merging at this time.

A supplied httpClientBuilder is used to build a new HTTP client instance for each service client, each with that service's HTTP defaults, so sharing one builder across clients yields separate instances with their own connection pools. Document this and point to httpClient(...) for sharing a single instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants