Skip to content

Wrong response code from failed precondition If-None-Match #6023

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

Open
1 task
bbraatCrwd opened this issue Apr 10, 2025 · 5 comments
Open
1 task

Wrong response code from failed precondition If-None-Match #6023

bbraatCrwd opened this issue Apr 10, 2025 · 5 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@bbraatCrwd
Copy link

Describe the bug

When submitting a write to an object in S3 with the If-None-Match header set in the SDK, a 200 response code can occasionally be returned along with the expected Exception, rather than the expected 412 response code.

Regression Issue

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

Expected Behavior

I expect to see a 412 response code every time this pre-condition is not met. The flakiness of the response code makes handling the return more cumbersome.

Current Behavior

This is a possible Exception/response payload that can be returned on failing the pre-condition:
software.amazon.awssdk.services.s3.model.S3Exception: At least one of the pre-conditions you specified did not hold (Service: S3, Status Code: 200, Request ID: 9YD49V2HRSDRS8K1, Extended Request ID: jUpbn2VaLT6Kwi6vyaN32y1OOWX0ShIocGfV+9+I7qG7kmmAR7kVCA3WATwcjpDMPdTEg3hLPuI=)

Reproduction Steps

The issue happens intermittently on the S3 side and it is not clear how to reproduce.

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.29.1

JDK version used

24

Operating System and version

Multiple environments

@bbraatCrwd bbraatCrwd added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2025
@debora-ito
Copy link
Member

Reproduction Steps
The issue happens intermittently on the S3 side and it is not clear how to reproduce.

Understood. Can you provide a code snippet showing the s3 client and the GetObject request call, so I can try to reproduce the same conditions?

@debora-ito debora-ito added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Apr 11, 2025
@debora-ito debora-ito self-assigned this Apr 11, 2025
@steveloughran
Copy link

so it is an exception being triggered -but the status code is 200?

odd

@bbraatCrwd
Copy link
Author

Reproduction Steps
The issue happens intermittently on the S3 side and it is not clear how to reproduce.

Understood. Can you provide a code snippet showing the s3 client and the GetObject request call, so I can try to reproduce the same conditions?

This is on upload, not download. The example I was looking at was on a multipart upload during one of the upload part calls:
val uploadPartRequest = UploadPartRequest.builder() .bucket(bucket) .key(key) .uploadId(uploadId) .partNumber(partNumber) .contentMD5(chunkMd5) .contentLength(chunk.length) val body = AsyncRequestBody.fromBytesUnsafe(chunk) client.uploadPart(uploadPartRequest.build(), body)

@bbraatCrwd
Copy link
Author

so it is an exception being triggered -but the status code is 200?

odd

That is correct, we receive it like any other exception, but the status code is a 200 instead of the expected 412

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Apr 16, 2025
@debora-ito
Copy link
Member

@bbraatCrwd sorry, you're right, if-none-match makes no sense with read operations.

I'm wondering if this is a s3 server-side issue - the SDK usually don't modify a response status code, according to the exception you pasted it looks like the 200 was sent by s3, the SDK is only unmarshalling the response. Maybe some edge case of what is described in the multipart upload scenario here.

One way to confirm this is to generate the verbose wirelogs and get the actual response at the error moment (instructions for the verbose wirelogs can be found in our Dev Guide); the other is to reach out to the s3 team with your request ID (you'll need to provide a more recent one) and ask them to investigate. Let us know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants