-
Notifications
You must be signed in to change notification settings - Fork 965
Description
Describe the bug
One can use conditional writes with either PutObject or CompleteMultipartUpload to effectively put object only if it doesn't exist yet (If-None-Match: *).
This works great in principle. This fails when there is a network issue and AWS SDK implicitly retries the underlying request:
- first request goes through and reaches the server, creating the object
- the response does not make it to the client though
- the client retries the request
- this second request fails with HTTP Status-Code 412: Precondition Failed
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
PutObject should remain idempotent also when If-None-Match: * condition is used, as far as retries done by the library are concerned.
in other words, the application layer should be able to use If-None-Match: * write condition without doing a lot additional work on the calling side
Current Behavior
PutObject If-None-Match: * write condition leads to application errors when networking circumstances lead to a request being retried on the calling side.
Reproduction Steps
Any PutObject that sets software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder.ifNoneMatch to * can be used to reproduce the issue, but full reproduction requires injecting network failures.
If this helps, i can try to produce such a test case with shopify/toxiproxy. Let me know if I should spend time on this.
Possible Solution
Tagging put objects creations with something that can identify them on the retried request.
Additional Information/Context
No response
AWS Java SDK version used
2.39.1
JDK version used
25
Operating System and version
MacOS 15.6