Skip to content
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

Enhance error reporting in the put_object operation. #1007

Open
rajdchak opened this issue Sep 10, 2024 · 0 comments
Open

Enhance error reporting in the put_object operation. #1007

rajdchak opened this issue Sep 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rajdchak
Copy link
Contributor

rajdchak commented Sep 10, 2024

Mountpoint for Amazon S3 version

Latest version

AWS Region

No response

Describe the running environment

Running in local.

Mountpoint options

NA

What happened?

The current error handling approach in the put_object operation might not be providing sufficient detail. Specifically, when an error occurs during the put_object operation, we are only sending the crt_error part of the meta request result. This output often looks like:
Unknown CRT error: CRT error 14343: aws-c-s3: AWS_ERROR_S3_INVALID_RESPONSE_STATUS, Invalid response status from request
However, the actual error message from the meta request result provides much more clarity. For instance, the full meta request result includes details such as:

MetaRequestResult { response_status: 400, crt_error: Error(14343, "aws-c-s3: AWS_ERROR_S3_INVALID_RESPONSE_STATUS, Invalid response status from request"), error_response_headers: Some(Headers { inner: 0x6000014fc080 }), error_response_body: Some("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidToken</Code><Message>The provided token is malformed or otherwise invalid.</Message><Token-0>IQoJb3JpZ2luX2VjEDYaCXVzLWVhc3QtMSJIMEYCIQDLFxf8o3wpHIhdDU1dWFvOaHvEOkZOTtDiJRIaNQR2rAIhALPZYJkTUhXtlQK6mcOzR1FpGSKPKZ117zVW9oy+7nWcKp4CCF4QARoMMTE5NjgzNTA4OTE5IgwdiMsiu8ooxC/zMO4q+wGpjTiFPtq2zPMC0+K0czqQQFRVE1Vcmq/QtZDpVsX1vP5c8tfYtQo5GOFvxg1jGx+uUyS3gZ/dtt0gZAXhb1jyoiLz27loUtQHmQCSQNCPeaSTOOrUWP45FYEY3taGHfW+5wu4ersuS9GKcKjKH7BywHq//NU3YzUcwTd+qoTs89eHZeWxzm7kZ5YW5XmHHagAjwKMXlw+Sp+oEgZaYzOLkx4yT3u+CRQ1Wh5jnHxiKITvNXbpwRq4FjTCd3mcmS2KYwk9X2IdOS9IL3ZJfnb8jTe0ssmgj3axbbzVXdzqhcNTRhCVu3P2sFVvj92Fql1LiYsVrsRGyCAlfTCi5fu2BjqcAfThWbs+4+2ke/RRYuzpCcCIWaWkpzYFeLK5CBlgvoGWq4DttxrWcDk6ey6Ftnh5BUcR4T6MZubneVqyS39uc41OQi7qOZ1LYNPQ6NGRXJSyGeai7/+q/SPGGkegbQBgynB1wUoTGb+aMJNR3vSJWwIBH+SLsx5nNCBMlBLdadAHqVpV4RkRZERgHCO+wLtKw2+WwifG7</Token-0><RequestId>30GF3JD37PN8JRRZ</RequestId><HostId>75I4LL0gyd4AE/ClR1FMx72Ub/qNRZc378GHu4LCMUfU8WdDpO3/z5HWzYgZ2BVyuUMZ2+ZLi5XemPTVpolG1g==</HostId></Error>") }

To improve the visibility and accuracy of error reporting, I suggest enhancing the error handling in the put_object operation to properly parse and include both the crt_error and the more detailed error_response_body from the meta request result. This change would provide clearer insights into the nature of the issues encountered.

Relevant log output

No response

@rajdchak rajdchak added the bug Something isn't working label Sep 10, 2024
github-merge-queue bot pushed a commit that referenced this issue Dec 18, 2024
`S3CrtClient::put_object` was originally implemented so that it would
complete immediately and return a `PutObjectRequest` implementation. Any
error from the S3 request would only be returned on calling `write` or
`complete` on the `PutObjectRequest`. With this change, we modify
`put_object` to await for the initial `CreateMultipartUpload` request to
complete and only then either return a `PutObjectRequest` or propagate
the error from the request. This is analogous to what done for
`get_object` in #1171 and addresses an issue where errors were not
propagated correctly (#1007).

At the file handle level, however, we still want the `open` operation to
complete quickly, without waiting for `CreateMultipartUpload` to
complete. In order to preserve the previous behavior, `upload::atomic`
was adapted to spawn a concurrent task in the background when calling
`put_object`.

### Does this change impact existing behavior?

Yes.

### Does this change need a changelog entry?

Yes, for `mountpoint-s3-client`. No user-visible changes in
`mountpoint-s3`.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and I agree to the terms of
the [Developer Certificate of Origin
(DCO)](https://developercertificate.org/).

---------

Signed-off-by: Alessandro Passaro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant