Repository navigation
rgw: cleanup special handling of errors - #59984
tobias-urdin wants to merge 1 commit into
Conversation
This changes the rgw_http_errors from being a pair to a tuple that now also includes a potential default error message. This removes the special cases added in the code just to be able to set an error message in a good way. This changes the error message for an expired presigned URL to "Request has expired" as per the AWS S3 [1] standard message. A future improvement here is addressing the comment about cleaning up the error handling in Swift, another improvement is getting rid of the set_req_state_err() signature that takes in a error message and rework that to something like set_req_state_err_msg and rely on everything else by default from rgw_http_errors. [1] https://repost.aws/knowledge-center/request-has-expired-s3-object Signed-off-by: Tobias Urdin <[email protected]>
cbodley
left a comment
There was a problem hiding this comment.
overall i'm not sure that i prefer this approach to what we have now. this pr seems to assume there's a one-to-one mapping from error codes to messages, which is very much not the case - especially for EINVAL which generally tries to say exactly which request parameter is wrong
| e->s3_code = r->second.second; | ||
| e->http_ret = std::get<0>(r->second); | ||
| e->s3_code = std::get<1>(r->second); | ||
| e->message = std::get<2>(r->second); |
There was a problem hiding this comment.
if an op has already set s->err.message, this would overwrite it
in most cases (all?), ops that set s->err.message do so before their call to set_req_state_err()
There was a problem hiding this comment.
not sure if i follow, i can't see that this touches req_state (s) anywhere and is just a helper function to get an error by number a populate the struct referenced by a pointer (e)...?
but i agree that this might need more testing unless we have a lot of functional testing that verifies error messages returned
There was a problem hiding this comment.
sorry, you're right about rgw_get_errno_s3()
search_err() from rgw_common.cc is the one that would overwrite s->err.message when called by set_req_state_err(req_state* s, int err_no)
I understand, it's a good mini project to get more familiar with other parts of the codebase. My idea was to get rid of hacky approach of checking the return value for a specific error just to translate it to another one and instead just return the original error in the function and handle it like "any other error" when it gets passed down. This could need some more polishing and testing for sure unless we are sure that we test error message in responses for most/all API calls we test (we probably don't for most API calls would be my guess?). My plan for those that are special is to get rid of some function signatures for Either way – let's ignore this for now and I'll respin this with a more complete approach if I get some time over to deep-dive more since the immediate issue is solved with 500 API error with the other patch. |
|
|
||
| ops_log_entry.error = true; | ||
| ops_log_entry.http_status = r.http_ret; | ||
| ops_log_entry.error_message = r.s3_code; |
There was a problem hiding this comment.
todo: this should probaby be ops_log_entry.error_message = r.message
| e->s3_code = r->second.second; | ||
| e->http_ret = std::get<0>(r->second); | ||
| e->s3_code = std::get<1>(r->second); | ||
| e->message = std::get<2>(r->second); |
There was a problem hiding this comment.
not sure if i follow, i can't see that this touches req_state (s) anywhere and is just a helper function to get an error by number a populate the struct referenced by a pointer (e)...?
but i agree that this might need more testing unless we have a lot of functional testing that verifies error messages returned
This changes the rgw_http_errors from being a pair to a tuple that now also includes a potential default error message.
This removes the special cases added in the code just to be able to set an error message in a good way.
This changes the error message for an expired presigned URL to "Request has expired" as per the AWS S3 [1] standard message.
A future improvement here is addressing the comment about cleaning up the error handling in Swift, another improvement is getting rid of the set_req_state_err() signature that takes in a error message and rework that to something like set_req_state_err_msg and rely on everything else by default from rgw_http_errors.
[1] https://repost.aws/knowledge-center/request-has-expired-s3-object
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e