-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add connection poisoning to aws-smithy-client #2445
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
cb0ef09
to
ac7987f
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
ac7987f
to
722635c
Compare
722635c
to
672bb6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on this!
@@ -108,7 +117,30 @@ use tower::{BoxError, Service}; | |||
/// see [the module documentation](crate::hyper_ext). | |||
#[derive(Clone, Debug)] | |||
#[non_exhaustive] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore:
#[non_exhaustive] |
ReconnectOnTransientError, | ||
|
||
/// Disable reconnects | ||
NoReconnect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name here is probably good enough, but I could see how it could potentially cause confusion with reconnecting on hang up or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe NoReuseBadConnection
? Usage is clearer from the tests / examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed NoReconnect
to ReuseAllConnections
A new generated diff is ready to view.
A new doc preview is ready to view. |
CHANGELOG.next.toml
Outdated
be reused. | ||
""" | ||
references = ["aws-sdk-rust#160", "smithy-rs#2445"] | ||
meta = { "breaking" = false, "tada" = false, "bug" = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah—we changed the default to all
at some point which is why this isn't an error
19a739b
to
3edbc5e
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WireLevelTestConnection
is pretty cool!
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
let capture_conn = capture_conn.clone(); | ||
if let Some(conn) = capture_conn.clone().connection_metadata().as_ref() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need the double clone here?
http_info.map(|info| info.remote_addr()), | ||
move || match capture_conn.connection_metadata().as_ref() { | ||
Some(conn) => conn.poison(), | ||
None => tracing::trace!("no connection existed to poison"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rephrase this error message like no connection found that should be poisoned
?
} | ||
tracing::debug!("replying with {:?}", next_event); | ||
let event = generate_response_event(next_event).await; | ||
dbg!(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a leftover or do we want to debug every time we spinup a new mock?
let sock_addr = self.socket_addr; | ||
let log = self.log.clone(); | ||
Box::pin(async move { | ||
println!("looking up {:?}, replying with {:?}", req, sock_addr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: is this a leftover?
Motivation and Context
Description
Built on top of two changes to Hyper, this adds the concept of connection poisoning to Smithy client. To do this, we needed machinery to get access to the "connection metadata" used by the request. This is done in a connector agnostic way with the
CaptureSmithyConnection
bridge.A separate layer considers the error classification then invokes poison as necessary. To support testing this,
WireLeveMock
was created, a mocking facility that binds to 0.0.0.0.For AWS services, this behavior is enabled by default. For generic-smithy clients, this behavior is disabled by default.
Testing
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.