aws-sdk-rust: GoAway errors using the SDK

Describe the bug

I am seeing such errors when using aws polly after an arbitrary amount of time (can be hours, can be minutes):

0:06:15.734081193 132822 0x7fbbc4000f70 ERROR               awspolly imp.rs:227:gstaws::polly::imp::Polly::send::{{closure}}::{{closure}}:<awspolly0> Failed sending text chunk: dispatch failure (DispatchFailure(DispatchFailure { source: ConnectorError { kind: Other(None), source: hyper::Error(Http2, Error { kind: GoAway(b"", NO_ERROR, Remote) }), connection: Unknown } })) (dispatch failure: other: http2 error: connection error received: not a result of an error: connection error received: not a result of an error (DispatchFailure(DispatchFailure { source: ConnectorError { kind: Other(None), source: hyper::Error(Http2, Error { kind: GoAway(b"", NO_ERROR, Remote) }), connection: Unknown } })))

As I understand it it should be up to the SDk to retry in such cases, not the application?

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I don’t expect GoAway errors to surface to my application

Current Behavior

GoAway errors surface to my application

Reproduction Steps

I do not have a readymade sample for this

Possible Solution

No response

Additional Information/Context

No response

Version

│   ├── aws-config v1.6.1
│   │   ├── aws-credential-types v1.2.2
│   │   │   ├── aws-smithy-async v1.2.5
│   │   │   ├── aws-smithy-runtime-api v1.7.4
│   │   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   │   ├── aws-smithy-types v1.3.0
│   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-runtime v1.5.6
│   │   │   ├── aws-credential-types v1.2.2 (*)
│   │   │   ├── aws-sigv4 v1.3.0
│   │   │   │   ├── aws-credential-types v1.2.2 (*)
│   │   │   │   ├── aws-smithy-eventstream v0.60.8
│   │   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   │   ├── aws-smithy-http v0.62.0
│   │   │   │   │   ├── aws-smithy-eventstream v0.60.8 (*)
│   │   │   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   ├── aws-smithy-eventstream v0.60.8 (*)
│   │   │   ├── aws-smithy-http v0.62.0 (*)
│   │   │   ├── aws-smithy-runtime v1.8.1
│   │   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   │   ├── aws-smithy-http v0.62.0 (*)
│   │   │   │   ├── aws-smithy-http-client v1.0.1
│   │   │   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   │   │   │   │   ├── aws-lc-rs v1.13.0
│   │   │   │   │   │   │   │   ├── aws-lc-sys v0.28.0
│   │   │   │   │   │   │   │   ├── aws-lc-rs v1.13.0 (*)
│   │   │   │   ├── aws-smithy-observability v0.1.2
│   │   │   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-types v1.3.6
│   │   │   │   ├── aws-credential-types v1.2.2 (*)
│   │   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-sdk-sso v1.64.0
│   │   │   ├── aws-credential-types v1.2.2 (*)
│   │   │   ├── aws-runtime v1.5.6 (*)
│   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   ├── aws-smithy-http v0.62.0 (*)
│   │   │   ├── aws-smithy-json v0.61.3
│   │   │   │   └── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-types v1.3.6 (*)
│   │   ├── aws-sdk-ssooidc v1.65.0
│   │   │   ├── aws-credential-types v1.2.2 (*)
│   │   │   ├── aws-runtime v1.5.6 (*)
│   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   ├── aws-smithy-http v0.62.0 (*)
│   │   │   ├── aws-smithy-json v0.61.3 (*)
│   │   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-types v1.3.6 (*)
│   │   ├── aws-sdk-sts v1.65.0
│   │   │   ├── aws-credential-types v1.2.2 (*)
│   │   │   ├── aws-runtime v1.5.6 (*)
│   │   │   ├── aws-smithy-async v1.2.5 (*)
│   │   │   ├── aws-smithy-http v0.62.0 (*)
│   │   │   ├── aws-smithy-json v0.61.3 (*)
│   │   │   ├── aws-smithy-query v0.60.7
│   │   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   │   ├── aws-smithy-xml v0.60.9
│   │   │   ├── aws-types v1.3.6 (*)
│   │   ├── aws-smithy-async v1.2.5 (*)
│   │   ├── aws-smithy-http v0.62.0 (*)
│   │   ├── aws-smithy-json v0.61.3 (*)
│   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-types v1.3.6 (*)
│   ├── aws-credential-types v1.2.2 (*)
│   ├── aws-sdk-polly v1.68.0
│   │   ├── aws-credential-types v1.2.2 (*)
│   │   ├── aws-runtime v1.5.6 (*)
│   │   ├── aws-sigv4 v1.3.0 (*)
│   │   ├── aws-smithy-async v1.2.5 (*)
│   │   ├── aws-smithy-http v0.62.0 (*)
│   │   ├── aws-smithy-json v0.61.3 (*)
│   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-types v1.3.6 (*)
│   ├── aws-sdk-s3 v1.82.0
│   │   ├── aws-credential-types v1.2.2 (*)
│   │   ├── aws-runtime v1.5.6 (*)
│   │   ├── aws-sigv4 v1.3.0 (*)
│   │   ├── aws-smithy-async v1.2.5 (*)
│   │   ├── aws-smithy-checksums v0.63.1
│   │   │   ├── aws-smithy-http v0.62.0 (*)
│   │   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-smithy-eventstream v0.60.8 (*)
│   │   ├── aws-smithy-http v0.62.0 (*)
│   │   ├── aws-smithy-json v0.61.3 (*)
│   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-smithy-xml v0.60.9 (*)
│   │   ├── aws-types v1.3.6 (*)
│   ├── aws-sdk-transcribestreaming v1.66.0
│   │   ├── aws-credential-types v1.2.2 (*)
│   │   ├── aws-runtime v1.5.6 (*)
│   │   ├── aws-sigv4 v1.3.0 (*)
│   │   ├── aws-smithy-async v1.2.5 (*)
│   │   ├── aws-smithy-eventstream v0.60.8 (*)
│   │   ├── aws-smithy-http v0.62.0 (*)
│   │   ├── aws-smithy-json v0.61.3 (*)
│   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-types v1.3.6 (*)
│   ├── aws-sdk-translate v1.64.0
│   │   ├── aws-credential-types v1.2.2 (*)
│   │   ├── aws-runtime v1.5.6 (*)
│   │   ├── aws-smithy-async v1.2.5 (*)
│   │   ├── aws-smithy-http v0.62.0 (*)
│   │   ├── aws-smithy-json v0.61.3 (*)
│   │   ├── aws-smithy-runtime v1.8.1 (*)
│   │   ├── aws-smithy-runtime-api v1.7.4 (*)
│   │   ├── aws-smithy-types v1.3.0 (*)
│   │   ├── aws-types v1.3.6 (*)
│   ├── aws-types v1.3.6 (*)

Environment details (OS name and version, etc.)

Linux Fedora 40

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @aajtodd @landonxjames I’ve managed to reproduce this error in a repository here: https://github.com/Veetaha/aws-sdk-rust-go-away-retries-bug-repro. You can clone it and just do cargo run where you’ll see the error and the warning in the terminal.

For that I had to fork hyper 0.14.32 and patch it with some code that synthetically injects the GoAway error (https://github.com/Veetaha/hyper/commit/0a82bb74fe98280c24337e612805ed698550fd2c).

The core problem is in how the aws-sdk-lambda and aws-config are configured with Rust features.

[dependencies]
aws-config     = { version = "1.0", default-features = false, features = ["behavior-version-latest", "rt-tokio", "credentials-process", "sso"] }
aws-sdk-lambda = { version = "1.0", default-features = false, features = ["behavior-version-latest", "rt-tokio", "rustls"] }

We are using the legacy rustls feature, because we just can’t compile aws-lc-sys on our supported windows platforms. So we have to disable it, but this unfortunately pulls in the old hyper 0.14.32 version.

In turn, this means that we are using the hyper_legacy.rs implementation of the HttpConnector. However, when AWS SDK was migrating to hyper 1.0 a nuance was missed that hyper 1.0 depends on the version 0.4 of the h2 crate. However, hyper 0.14.32 depends on 0.3 of the h2 crate.

And aws-smithy-http-client depends on h2 0.4 unconditionally. So this code here: https://github.com/awslabs/aws-sdk-rust/blob/8604e6c91cd61515f16cb85e6a90347711b5e728/sdk/aws-smithy-http-client/src/hyper_legacy.rs#L385

It uses the wrong version of the h2 crate. It must use the h2 0.3 instead of 0.4 when downcasting the error to h2::Error.

Fantastic reproduction @Veetaha, thank you!

PR up to fix this: https://github.com/smithy-lang/smithy-rs/pull/4145

Level::TRACE would be most helpful since we could see all of the logs