hcrosse opened a new issue, #919:
URL: https://github.com/apache/arrow-rs-object-store/issues/919

   **Describe the bug**
   
   Two related bugs affect S3 operations that can return an XML `<Error>` 
inside an HTTP 200 response:
   
   1. 
[`body_contains_error`](https://github.com/apache/arrow-rs-object-store/blob/main/src/client/retry.rs#L267)
 checks `response_body.contains("InternalError") || 
response_body.contains("SlowDown")`. Valid S3 keys or buckets containing either 
string (for example `logs/InternalError.parquet` or `metrics/SlowDown.csv`) 
cause `complete_multipart` to retry an already finalized upload into `404 
NoSuchUpload` (`Error::NotFound`), and cause `delete_stream` to retry a 
successful `<DeleteResult>` until retries are exhausted. A `<DeleteResult>` 
containing an individual `<Error><Code>InternalError</Code></Error>` also 
triggers whole batch retries.
   2. `AmazonS3::copy_opts` in 
[`src/aws/mod.rs`](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/mod.rs#L405)
 discards the HTTP 200 response body without checking for `<CopyObjectResult>`. 
Any HTTP 200 XML `<Error>` with a code other than `InternalError` or `SlowDown` 
(such as `ServiceUnavailable` or `AccessDenied`), or a truncated empty HTTP 200 
body, silently returns `Ok(())` even though the copy did not happen.
   3. `S3Client::put_part` with `PutPartPayload::Copy` (`UploadPartCopy`) does 
not enable `retry_error_body(true)`, so transient HTTP 200 `<Error>` responses 
fail instead of retrying.
   
   **To Reproduce**
   
   1. Call `put_multipart` and `complete` on a path such as 
`logs/InternalError.parquet`, or call `delete_stream` on `metrics/SlowDown.csv` 
against an S3 server returning a normal HTTP 200 
`<CompleteMultipartUploadResult>` or `<DeleteResult>` XML body.
   2. Call `copy` or `copy_if_not_exists` against an S3 endpoint returning HTTP 
200 with:
   
   ```xml
   <?xml version="1.0" encoding="UTF-8"?>
   <Error><Code>ServiceUnavailable</Code><Message>Please reduce your request 
rate.</Message></Error>
   ```
   
   `copy` returns `Ok(())`.
   
   **Expected behavior**
   
   Valid `<CompleteMultipartUploadResult>` and `<DeleteResult>` responses 
should succeed without retrying regardless of key names. HTTP 200 XML `<Error>` 
responses should retry transient codes (`InternalError`, `SlowDown`, 
`ServiceUnavailable`, `RequestTimeout`) and fail immediately on permanent codes 
such as `AccessDenied`. `copy_opts` should reject HTTP 200 responses that are 
not a valid `<CopyObjectResult>` XML document.
   
   **Additional context**
   
   AWS documents that `CopyObject`, `UploadPartCopy`, 
`CompleteMultipartUpload`, and `DeleteObjects` can return HTTP 200 OK with 
leading keepalive whitespace followed by an `<Error>` XML body.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to