---
title: "Can an AWS SDK for Rust call hang forever? | Proofline"
description: "An AWS SDK for Rust call can spend minutes waiting for a response."
url: https://proofline.sh/learn/aws-sdk-rust-default-read-timeout/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Can an AWS SDK for Rust call hang forever?

An AWS SDK for Rust call can spend minutes waiting for a response. The SDK set a connect timeout but no read timeout, so a peer that accepted the request and never answered held the call open. Clients built with BehaviorVersion::latest() on the 17 November 2026 release get a read timeout per service, 5 minutes for most, and retry it like any transient error. Three default STS attempts can spend 15 minutes waiting for headers alone. Set explicit attempt and operation timeouts to bound the time your application waits.

Network outages The Proofline team December 2, 2026 6 min read

## What each timeout bounds

A call to an AWS service goes through four phases that can each stall: opening the connection, sending the request, waiting for the response headers, and reading the body. The SDK for Rust has a separate setting for each span. [Configuring timeouts in the AWS SDK for Rust](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/timeouts.html) lists them:

-   **Connect timeout**, 3.1 seconds by default: the wait for a connection.
-   **Read timeout**: the wait from sending the request to the first byte of the response.
-   **Operation attempt timeout**: the whole of one HTTP attempt.
-   **Operation timeout**: the whole call, across every retry.

That page's table gives no default for the last three. It describes the behavior versions before `v2026_11_17`. A peer that completed the TCP handshake, perhaps a proxy, a load balancer with a dead target or a server stuck in a lock, could hold a call on the read for as long as the connection lived. On Linux, a connection waiting to read with no data in flight has no timeout of its own, and a TCP keepalive probe does not help: the peer's kernel answers it whether or not the application ever will.

## What v2026_11_17 changes

The SDK ties changes in default behavior to a `BehaviorVersion`, so that upgrading a crate does not change behavior unless you ask for the new version. `BehaviorVersion::latest()` asks for whatever the crate you compiled against considers newest. The [BehaviorVersion documentation](https://docs.rs/aws-config/latest/aws_config/struct.BehaviorVersion.html) describes `v2026_11_17` as applying a default read timeout that "bounds the span from request dispatch until response headers arrive". The value depends on the service: 5 minutes generally, 15 minutes for services that legitimately hold a connection open before replying, and none for services where a bound would break normal use, such as S3, which cannot send response headers before a large upload finishes. A read timeout you configure yourself always wins.

The change landed in [smithy-rs pull request 5004](https://github.com/smithy-lang/smithy-rs/pull/5004). In the generated crates, aws-sdk-sts 1.127.0 stores 300,000 ms and aws-sdk-rds 1.163.0 stores 900,000 ms.

A client pinned to an older version, such as `BehaviorVersion::v2026_01_12()`, keeps the old behavior after the upgrade. The older constructors are deprecated, so the compiler warns about them.

## The lab

The lab points an STS client at a local socket that accepts connections and never answers, then calls `GetCallerIdentity` three ways: with `latest()`, with an older behavior version, and with explicit timeouts. A tokio timeout of 20 minutes stops the call that would otherwise never end. `Cargo.toml`:

```
[dependencies]
aws-config = "=1.13.3"
aws-sdk-sts = "=1.127.0"
tokio = { version = "1", features = ["full"] }
```

`src/main.rs`:

```
use std::{net::TcpListener, sync::atomic::{AtomicUsize, Ordering}, sync::Arc, thread, time::{Duration, Instant}};
use aws_config::{timeout::TimeoutConfig, BehaviorVersion};

#[tokio::main]
async fn main() {
    // A peer that accepts every connection and never answers.
    let listener = TcpListener::bind("127.0.0.1:0").unwrap();
    let endpoint = format!("http://{}", listener.local_addr().unwrap());
    let accepted = Arc::new(AtomicUsize::new(0));
    let count = accepted.clone();
    thread::spawn(move || {
        let mut held = Vec::new();
        for stream in listener.incoming() {
            count.fetch_add(1, Ordering::SeqCst);
            held.push(stream.unwrap());
        }
    });

    let variant = std::env::args().nth(1).unwrap_or_default();
    let behavior = if variant == "old" { BehaviorVersion::v2026_01_12() } else { BehaviorVersion::latest() };
    let mut loader = aws_config::defaults(behavior).region("us-east-1").endpoint_url(&endpoint);
    if variant == "explicit" {
        loader = loader.timeout_config(
            TimeoutConfig::builder()
                .connect_timeout(Duration::from_secs(3))
                .read_timeout(Duration::from_secs(5))
                .operation_timeout(Duration::from_secs(30))
                .build(),
        );
    }
    let sts = aws_sdk_sts::Client::new(&loader.load().await);

    let start = Instant::now();
    let call = sts.get_caller_identity().send();
    match tokio::time::timeout(Duration::from_secs(1200), call).await {
        Ok(Ok(_)) => println!("{variant}: answered"),
        Ok(Err(e)) => println!("{variant}: error after {:.1} s, {} connections: {:?}",
            start.elapsed().as_secs_f64(), accepted.load(Ordering::SeqCst),
            aws_sdk_sts::error::DisplayErrorContext(&e)),
        Err(_) => println!("{variant}: still waiting after {:.0} s, {} connections",
            start.elapsed().as_secs_f64(), accepted.load(Ordering::SeqCst)),
    }
}
```

```
docker run --rm -v "$PWD":/lab -w /lab rust:1 cargo build --release
for v in latest old explicit; do
  docker run -d --name sts-$v -e AWS_ACCESS_KEY_ID=test -e AWS_SECRET_ACCESS_KEY=test \
    -e AWS_EC2_METADATA_DISABLED=true -v "$PWD":/lab -w /lab rust:1 ./target/release/sts-hang $v
done
```

The build took three minutes; the slowest run takes 20. The three runs printed, trimmed:

```
explicit: error after 15.1 s, 3 connections: ... HttpTimeoutError { kind: "HTTP read", duration: 5s } ...
latest: error after 900.1 s, 3 connections: ... HttpTimeoutError { kind: "HTTP read", duration: 300s } ...
old: still waiting after 1200 s, 1 connections
```

The old behavior version opened one connection and was still waiting when the lab gave up 20 minutes later; nothing in the SDK would have ended it. `latest()` timed out after 300 seconds, retried twice on new connections, and failed after 900 seconds, three full read timeouts. With a 5-second read timeout the same three attempts took 15 seconds. The retries are the part people miss: the default read timeout bounds one attempt, and the standard retry policy makes three.

## Choose your own bounds

The new default is a backstop. It ends a call that would otherwise hold a task, a connection-pool slot or a lock until a restart, and a [hung process](/learn/hung-process-evidence-before-restart/) caused by one looks like a deadlock until you read its stacks. It does not make the call fit your request's deadline. Set the bounds from what the caller can wait:

```
let config = aws_config::defaults(BehaviorVersion::latest())
    .timeout_config(
        TimeoutConfig::builder()
            .operation_attempt_timeout(Duration::from_secs(10))
            .operation_timeout(Duration::from_secs(30))
            .build(),
    )
    .load()
    .await;
```

An attempt timeout bounds each try; the operation timeout caps all of them together, retries and backoff included. Neither applies to a streamed body that you read after the SDK has returned the response; stalled-stream protection covers that.

Check three things in your own code:

-   Search for `BehaviorVersion::v20` to find clients pinned to an older version. They keep the old behavior until you move them.
-   Find every client built without a `TimeoutConfig`, especially those used inside a request handler or while holding a lock.
-   Keep the client's timeouts below the timeout of whatever calls you, so your code reports the AWS call as the cause instead of being cut off by its own caller.

Long-lived connections that die quietly in a NAT or load balancer are a different failure, with resets rather than waits; see [connection resets on idle pooled connections](/learn/connection-reset-idle-timeout/).

## The production case

In the production case behind this guide, a control plane assumed AWS roles through STS from five call sites, all on clients built with `BehaviorVersion::latest()` and none with a timeout of its own. Before the change, an STS endpoint that accepted a request and never sent response headers would have held the call until the operating system gave up. The fix moved seven crates of the SDK family to the 17 November 2026 release, a lock-file change with no source edits, which made `latest()` resolve to `v2026_11_17`: a 300,000 ms read timeout on STS and 900,000 ms on RDS, each retried as a transient error.

## Where this came from

Proofline found this in its own STS calls and shipped the SDK upgrade in its production release of 18 November 2026. The timeout values in [The production case](#case) are the ones those crates store. Proofline reviews GitHub pull requests; new organizations get one calendar month of hosted code review without a cloud connection. [Start a free GitHub review](https://proofline.sh/orgs/plan?offer=free150) · [Eligibility and fair-use terms](/free-code-review/)

## Questions

### Does the AWS SDK for Rust have a default timeout?

It has a 3.1-second connect timeout. From behavior version `v2026_11_17` it also has a per-service read timeout, 5 minutes for most services and none for S3. It has no default attempt or operation timeout.

### Does upgrading the SDK crates change timeouts by itself?

Only for clients built with `BehaviorVersion::latest()`. A client pinned to an older behavior version keeps that version's defaults.

### Is a read timeout retried?

Yes. The SDK classifies it as a transient error and retries it under the client's retry policy, three attempts in total by default, so the header waits can add up across attempts. Allow for retry backoff when you choose an overall operation timeout.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Capture a hung process before you restart it](/learn/hung-process-evidence-before-restart/)
    
    Capacity overruns The Proofline team November 24, 2026 3 min read
    
-   ### [Connection resets on idle pooled connections after a quiet period](/learn/connection-reset-idle-timeout/)
    
    Network outages The Proofline team November 23, 2026 6 min read
