Skip to content

UploadPart request occassionally fails with broken pipe error #621

Answered by jdisanti
Gun9niR asked this question in Q&A
Discussion options

You must be logged in to vote

I think that by converting hyper::Body into a ByteStream, you're inadvertently disabling retry for the operation since the SDK has no way to restart the stream in the event of failure. If you're streaming from a file, then you can use ByteStream::from_path to get streaming retry. Otherwise, you should use SdkBody::retryable to create an SdkBody, and then convert that SdkBody into a ByteStream. For example:

use aws_smithy_http::body::SdkBody;
use std::convert::Infallible;
use tokio_stream as stream;

fn get_upload_body(data: Vec<bytes::Bytes>) -> aws_sdk_s3::types::ByteStream {
    SdkBody::retryable(move || {
        SdkBody::from(hyper::Body::wrap_stream(stream::iter(
            data.clone

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Gun9niR
Comment options

@jdisanti
Comment options

@Gun9niR
Comment options

Answer selected by Gun9niR
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants