Skip to content

Commit ad97759

Browse files
authored
fix h2 goaway error retry regression (#4145)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> fixes awslabs/aws-sdk-rust#1272 ## Description <!--- Describe your changes in detail --> The hyper 1.x work introduced a regression to the hyper legacy 0.14 client's ability to retry h2::GoAway errors. This was due to the h2 version that each hyper version is pinned to as described in the reproduction in the issue. This is similar to the issue we've seen in the past with different major versions of a type being added to config bag. Also tested against hyper 1.x using the same mechanism supplied in the [reproduction](awslabs/aws-sdk-rust#1272 (comment)) (see aajtodd/hyper@7fe4ee6) to verify it also works as intended. ## Testing Tested repro locally with and without the fix. Without the fix I can see no retries attempted and the [warning message](https://github.com/smithy-lang/smithy-rs/blob/release-2025-05-19/rust-runtime/aws-smithy-http-client/src/hyper_legacy.rs#L393). With the fix retries are attempted and no warning message. ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "client," "server," or both in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 554cf30 commit ad97759

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

.changelog/1747837382.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
applies_to:
3+
- aws-sdk-rust
4+
- client
5+
authors:
6+
- aajtodd
7+
references:
8+
- aws-sdk-rust#1272
9+
breaking: false
10+
new_feature: false
11+
bug_fix: true
12+
---
13+
Fix h2 GoAway errors not being retried by hyper legacy client

aws/rust-runtime/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-runtime/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-runtime/aws-smithy-http-client/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "aws-smithy-http-client"
33
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
44
description = "HTTP client abstractions for generated smithy clients"
5-
version = "1.0.2"
5+
version = "1.0.3"
66
license = "Apache-2.0"
77
edition = "2021"
88
repository = "https://github.com/smithy-lang/smithy-rs"
@@ -14,6 +14,7 @@ hyper-014 = [
1414
"dep:http-02x",
1515
"dep:http-body-04x",
1616
"dep:hyper-0-14",
17+
"dep:h2-0-3"
1718
]
1819

1920
default-client = [
@@ -100,6 +101,7 @@ http-body-04x = { package = "http-body", version = "0.4.5" , optional = true}
100101
hyper-0-14 = { package = "hyper", version = "0.14.26", default-features = false, features = ["client", "http1", "http2", "tcp", "stream"], optional = true }
101102
legacy-hyper-rustls = { package = "hyper-rustls", version = "0.24", features = ["rustls-native-certs", "http2"], optional = true }
102103
legacy-rustls = { package = "rustls", version = "0.21.8", optional = true }
104+
h2-0-3 = { package = "h2", version = "0.3.24", optional = true }
103105
# end legacy stack deps
104106

105107
# test util stack

rust-runtime/aws-smithy-http-client/src/hyper_legacy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use aws_smithy_types::body::SdkBody;
2424
use aws_smithy_types::config_bag::ConfigBag;
2525
use aws_smithy_types::error::display::DisplayErrorContext;
2626
use aws_smithy_types::retry::ErrorKind;
27-
use h2::Reason;
27+
use h2_0_3::Reason;
2828
use hyper_0_14::client::connect::{capture_connection, CaptureConnection, Connection, HttpInfo};
2929
use std::borrow::Cow;
3030
use std::collections::HashMap;
@@ -382,7 +382,7 @@ fn to_connector_error(err: hyper_0_14::Error) -> ConnectorError {
382382
if err.is_incomplete_message() {
383383
return ConnectorError::other(err.into(), Some(ErrorKind::TransientError));
384384
}
385-
if let Some(h2_err) = find_source::<h2::Error>(&err) {
385+
if let Some(h2_err) = find_source::<h2_0_3::Error>(&err) {
386386
if h2_err.is_go_away()
387387
|| (h2_err.is_reset() && h2_err.reason() == Some(Reason::REFUSED_STREAM))
388388
{

0 commit comments

Comments
 (0)