Skip to content

Misleading exception during async getObject #6324

@devinrsmith

Description

@devinrsmith

Describe the bug

I was very confused when I saw this error message, as it implies there was an issue with uploading. This error was thrown as part of an asynchronous getObject request,

S3AsyncClient#getObject(ObjectRequest,AsyncResponseTransformer<GetObjectResponse,ReturnT>)

Note, "written" and "upload" in the exception message.

Caused by: software.amazon.awssdk.core.exception.RetryableException: Data read has a different checksum than expected. Was 0x14173258040ed24cc9dd698d1f43d8cf, but expected 0x001c00001c0000000607000050415231. Common causes: (1) You modified a request ByteBuffer before it could be written to the service. Please ensure your data source does not modify the  byte buffers after you pass them to the SDK. (2) The data was corrupted between the client and service. Note: Despite this error, the upload still completed and was persisted in S3.
                at software.amazon.awssdk.core.exception.RetryableException$BuilderImpl.build(RetryableException.java:99)
                at software.amazon.awssdk.core.exception.RetryableException.create(RetryableException.java:35)
                at software.amazon.awssdk.services.s3.internal.checksums.S3ChecksumValidatingPublisher$ChecksumValidatingSubscriber.onComplete(S3ChecksumValidatingPublisher.java:137)
                at software.amazon.awssdk.core.internal.metrics.BytesReadTrackingPublisher$BytesReadTracker.onComplete(BytesReadTrackingPublisher.java:74)
                at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler$DataCountingPublisher$1.onComplete(ResponseHandler.java:519)
                at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.runAndLogError(ResponseHandler.java:254)
                at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.access$600(ResponseHandler.java:77)
                at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler$PublisherAdapter$1.onComplete(ResponseHandler.java:375)

Regression Issue

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

Expected Behavior

More appropriate error message. (Probably makes sense to have the same error message as the sync case in .S3ChecksumValidatingInputStream#validateAndThrow)

Current Behavior

See description.

Reproduction Steps

(Not sure how to reproduce invalid checksums on demand.)

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.29.52

JDK version used

17.0.16

Operating System and version

Red Hat 9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions