Skip to content

Comments

rgw: handle EINVAL translation in forward_request#60899

Merged
cbodley merged 1 commit intoceph:mainfrom
clwluvw:curl-einval
Apr 23, 2025
Merged

rgw: handle EINVAL translation in forward_request#60899
cbodley merged 1 commit intoceph:mainfrom
clwluvw:curl-einval

Conversation

@clwluvw
Copy link
Member

@clwluvw clwluvw commented Dec 1, 2024

RGWRESTSimpleRequest::forward_request() translates EINVAL to a 503 status code to reflect connection errors as internal errors rather than client errors. However, if the master is explicitly returning EINVAL (which corresponds to an HTTP 400 status code), this translation incorrectly converts it to 503, hiding the true client error.

To address this, we now check the HTTP status code to ensure the error originates from easy_curl and not from a valid HTTP response, preserving the intended 400 status when appropriate.

Fixes: https://tracker.ceph.com/issues/69084

int r = process(dpp, y);
if (r < 0){
if (r == -EINVAL){
if (r == -EINVAL && http_status == 0) { // make sure no header were received
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can just leave http_status in the if clause so we return 503 on all internal curl errors no matter what the return code is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be ok. cc @cbodley

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard to know what issues this could cause. let's see what multisite tests do with just if (http_status == 0)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with only the http_status case.

RGWRESTSimpleRequest::forward_request() translates EINVAL to a 503
status code to reflect connection errors as internal errors rather
than client errors. However, if the master is explicitly returning
EINVAL (which corresponds to an HTTP 400 status code), this
translation incorrectly converts it to 503, hiding the true client
error.

To address this, we now check the HTTP status code to ensure the
error originates from easy_curl and not from a valid HTTP response,
preserving the intended 400 status when appropriate.

Fixes: https://tracker.ceph.com/issues/69084
Signed-off-by: Seena Fallah <[email protected]>
@clwluvw
Copy link
Member Author

clwluvw commented Dec 9, 2024

jenkins test api

@clwluvw
Copy link
Member Author

clwluvw commented Jan 9, 2025

jenkins test api

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@cbodley
Copy link
Contributor

cbodley commented Apr 23, 2025

Check for missing .qa links | Expected — Waiting for status to be reported

oh hell. apparently the only workaround is to close/reopen the pr and pass all the checks again 😿

@cbodley cbodley closed this Apr 23, 2025
@cbodley cbodley reopened this Apr 23, 2025
Copy link
Contributor

@cbodley cbodley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work in testing. yolo?

@clwluvw
Copy link
Member Author

clwluvw commented Apr 23, 2025

seems to work in testing. yolo?

i guess in RGWHTTPSimpleRequest we only set http_status in RGWHTTPSimpleRequest::receive_header(), so if we don't have any HTTP/x STATUS_CODE streams in, that should stay 0. and that var should have nothing to do with reqs_thread_entry() or rgw_http_req_data::finish() which is setting another http_status var which is not used by this function RGWRESTSimpleRequest::forward_request() we're talking about.

@clwluvw
Copy link
Member Author

clwluvw commented Apr 23, 2025

@clwluvw
Copy link
Member Author

clwluvw commented Apr 23, 2025

jenkins test make check arm64

@cbodley cbodley merged commit 637866d into ceph:main Apr 23, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants