Skip to content

rgw: fix miss handle curl error return#28345

Merged
cbodley merged 2 commits intoceph:masterfrom
tianshan:fix_http_return_check
Jun 4, 2019
Merged

rgw: fix miss handle curl error return#28345
cbodley merged 2 commits intoceph:masterfrom
tianshan:fix_http_return_check

Conversation

@tianshan
Copy link
Contributor

if meet tcp packet loss, curl return will be result=18(CURLE_PARTIAL_FILE)
and http_status=200, so sync will continue and cause content miss match.

Signed-off-by: Tianshan Qu tianshan@xsky.com

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

@tianshan
Copy link
Contributor Author

@cbodley @xiaoxichen maybe this is the root cause of https://tracker.ceph.com/issues/39992

@xiaoxichen
Copy link
Contributor

I think it is possible with (result = CURLE_PARTIAL_FILE and http_code = 200) however in previous code it also result an EAGAIN, isnt it?

@tianshan
Copy link
Contributor Author

tianshan commented Jun 1, 2019

@xiaoxichen the http_status is the http_code, so it will not return EAGAIN

@xiaoxichen
Copy link
Contributor

xiaoxichen commented Jun 2, 2019

static inline int rgw_http_error_to_errno(int http_err)
{
  if (http_err >= 200 && http_err <= 299)
    return 0;
int status = rgw_http_error_to_errno(http_status);
  if (result != CURLE_OK && http_status == 0) {
          status = -EAGAIN;
        }

status == 0 for your case where http_status = 200;
and
result = CURLE_PARTIAL_FILE

why it will not go to EAGAIN?

@tianshan
Copy link
Contributor Author

tianshan commented Jun 2, 2019

the condition here needs http_status == 0, but we got http_status = 200, so it will not return EAGAIN, and the status is 0, so the next finish_request will also not return error

@xiaoxichen
Copy link
Contributor

sigh...I read your new code...yes you are right.

@cbodley
Copy link
Contributor

cbodley commented Jun 3, 2019

thanks @tianshan! i wrote a test case for this and pushed it to https://github.com/cbodley/ceph/commits/wip-rgw-http-err, could you please include that commit cbodley@cfb452b in this pr?

without your fix applied, the test fails with:

[ RUN      ] HTTPManager.ReadTruncated
/home/cbodley/ceph/src/test/rgw/test_http_manager.cc:47: Failure
Expected equality of these values:
  -11
  RGWHTTP::process(&client, null_yield)
    Which is: 0
[  FAILED  ] HTTPManager.ReadTruncated (0 ms)

with your fix, it passes with a warning:

[ RUN      ] HTTPManager.ReadTruncated
[       OK ] HTTPManager.ReadTruncated (1 ms)
2019-06-03T11:58:21.063-0400 7f4b6f2e1700  0 ERROR: curl error: Failure when receiving data from the peer, maybe network unstable

tianshan and others added 2 commits June 4, 2019 11:33
if meet tcp packet loss, curl return will be result=18(CURLE_PARTIAL_FILE)
and http_status=200, so sync will continue and cause content miss match.

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

Signed-off-by: Tianshan Qu <tianshan@xsky.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
@tianshan tianshan force-pushed the fix_http_return_check branch from 36eabfa to c669cf2 Compare June 4, 2019 03:47
@tianshan
Copy link
Contributor Author

tianshan commented Jun 4, 2019

@cbodley done. and removed the if condition around dout in my commit, since status == 0 mostly means http_status = 200

@cbodley cbodley merged commit 2ade65a into ceph:master Jun 4, 2019
@cbodley
Copy link
Contributor

cbodley commented Jun 4, 2019

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