Skip to content

rgw: fix multipart upload object leaks due to re-upload - #49709

Merged
cbodley merged 3 commits into
ceph:mainfrom
yima77:rgw_fix_mp_upload_obj_leak_due_to_reupload
Feb 16, 2023
Merged

cbodley merged 3 commits into
ceph:mainfrom
yima77:rgw_fix_mp_upload_obj_leak_due_to_reupload

Conversation

@yima77

@yima77 yima77 commented Jan 10, 2023 •

Copy link
Copy Markdown
Contributor

This commit fixes the object leaks when an mp part object is re-uploaded. Details of the fix are:

  1. Upon re-upload, remember the prefix used in previous part upload in a new field "past_prefixes" in RGWUploadPartInfo.
  2. Create a new CLS function for updating part info in the metadata object.
  3. Utilize the new CLS function during mp upload.
  4. At the upload conclusion (compete/abort), clean up the part objects that are not used for the final
    assembly, thus preventing the object leak.

Fixes: https://tracker.ceph.com/issues/16767
Signed-off-by: Yixin Jin [email protected]

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/rgw/rgw_putobj_processor.cc Outdated

r = meta_obj->omap_set_val_by_key(dpp, p, bl, true, null_yield);
rgw_raw_obj meta_raw_obj;
dynamic_cast<rgw::sal::RadosObject*>(meta_obj.get())->get_raw_obj(&meta_raw_obj);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this line doesn't make sense? 1) seems you want to assign the downcast pointer to a variable? this must warn? also, 2) using dynamic_cast implies that the downcast can fail, if the returned object pointer is of a different descendant type--in that case, the returned pointer will be null, so we don't want to operate on it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. The sole purpose is to make the call to get_raw_obj(). Without it, it can only call get_obj(). I learned it from RadosBucket::remove_bucket_bypass_gc().

@mattbenjamin mattbenjamin Jan 11, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oh, I see. however, I think the dynamic cast is still an issue (maybe in both places, I don't know)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

However, a lingering concern is that MultipartObjectProcessor::complete() seems to try to be generic and not Rados specific. However, the first few lines of this function already directly refer to RGWRados. I suspect that it isn't as generic as hoped.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think there should at least be error checking from the dynamic_cast

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clearly, I agree with you, but it will be fully generic in due course

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could leave a comment here or at the other location, maybe, to highlight the issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Instead of using dynamic_cast, I changed to call obj_to_raw() in the 2nd commit. The whole purpose is to access more information from the raw obj.

@mattbenjamin
mattbenjamin requested a review from dang January 11, 2023 16:57
@mattbenjamin

mattbenjamin commented Jan 11, 2023 •

Copy link
Copy Markdown
Contributor

@dang what is your take on these rados dependencies in MPU? they can't be blockers for this change, I guess, but we should put them on the list of zipper issues

@mattbenjamin

Copy link
Copy Markdown
Contributor

@cbodley I've tested this change by hand--it seems like the way to automate this would be in ragweed, maybe?

My test method was to upload a 5m file containing generated data, with part 1 re-uploaded 45 times, print results from
radosgw-admin radoslist, download the completed object from S3, and check integrity with md5sum.
The radoslist result for the 45-reupload mpu object looked exactly similar to one with no-reuploads--the uploaded object is 8.7M in size and part size is 5M, so we have two chunks:

83e305a9-1e5f-43e5-921a-9111868330ba.4147.2__multipart_mpu_test3.byhsQ9xQIEvIcBfq08kxo3c7vccebYV8.1
83e305a9-1e5f-43e5-921a-9111868330ba.4147.2__shadow_mpu_test3.byhsQ9xQIEvIcBfq08kxo3c7vccebYV8.1_1
83e305a9-1e5f-43e5-921a-9111868330ba.4147.2__shadow_mpu_test3.byhsQ9xQIEvIcBfq08kxo3c7vccebYV8.1_2
83e305a9-1e5f-43e5-921a-9111868330ba.4147.2_mpu_test3

@mattbenjamin
mattbenjamin self-requested a review January 12, 2023 14:22

@mattbenjamin mattbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have tested using my own re-upload test case, seems to work as expected and I noticed nothing out of the ordinary.

@yima77

yima77 commented Jan 12, 2023

Copy link
Copy Markdown
Contributor Author

@cbodley I've tested this change by hand--it seems like the way to automate this would be in ragweed, maybe?

My test method was to upload a 5m file containing generated data, with part 1 re-uploaded 45 times, print results from radosgw-admin radoslist, download the completed object from S3, and check integrity with md5sum. The radoslist result for the 45-reupload mpu object looked exactly similar to one with no-reuploads--the uploaded object is 8.7M in size and part size is 5M, so we have two chunks:

83e305a9-1e5f-43e5-921a-9111868330ba.4147.2__multipart_mpu_test3.byhsQ9xQIEvIcBfq08kxo3c7vccebYV8.1 83e305a9-1e5f-43e5-921a-9111868330ba.4147.2__shadow_mpu_test3.byhsQ9xQIEvIcBfq08kxo3c7vccebYV8.1_1 83e305a9-1e5f-43e5-921a-9111868330ba.4147.2__shadow_mpu_test3.byhsQ9xQIEvIcBfq08kxo3c7vccebYV8.1_2 83e305a9-1e5f-43e5-921a-9111868330ba.4147.2_mpu_test3

@mattbenjamin You may want to test abort as well. If the re-uploads have occurred, aborting the whole upload should leave no orphans, either.

@dang

dang commented Jan 12, 2023

Copy link
Copy Markdown
Contributor

@dang what is your take on these rados dependencies in MPU? they can't be blockers for this change, I guess, but we should put them on the list of zipper issues

rgw_putobj_processor.cc is below the line, so it's part of RadosStore, and the casts will always succeed.

@mattbenjamin

Copy link
Copy Markdown
Contributor

@dang what is your take on these rados dependencies in MPU? they can't be blockers for this change, I guess, but we should put them on the list of zipper issues

rgw_putobj_processor.cc is below the line, so it's part of RadosStore, and the casts will always succeed.

oh, ok--I didnt realize

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice work!

Comment thread src/cls/rgw/cls_rgw_client.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/rgw/rgw_putobj_processor.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved

@yima77 yima77 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I have addressed all requested changes.

Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw_client.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/rgw/rgw_putobj_processor.cc Resolved
Comment thread src/cls/rgw/cls_rgw_client.cc Resolved

@yima77 yima77 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I hope it is now good to merge. :)

@cbodley

cbodley commented Jan 17, 2023

Copy link
Copy Markdown
Contributor

what's the plan for test coverage?

  • do the existing s3tests still pass?
  • are there any reupload tests cases that would catch regressions here?
  • how do we check for orphaned rados objects/index entries?

@yima77

yima77 commented Jan 17, 2023 •

Copy link
Copy Markdown
Contributor Author

what's the plan for test coverage?

* do the existing s3tests still pass?

* are there any reupload tests cases that would catch regressions here?

* how do we check for orphaned rados objects/index entries?

Existing s3tests functional tests pass/fail results are the same with and without this change. I ran s3tests.functional.test_s3 and there are two failures:

  1. s3tests.functional.test_s3.test_logging_toggle
  2. s3tests.functional.test_s3.test_bucket_policy_put_obj_enc

Both tests also failed without this change.

I have created new test cases in s3tests repo that is maintained internally at linode.com to test this particular change. I also made it to check rados objects but I had to change vstart.sh to speed up gc in order to make the new test pass.

@cbodley

cbodley commented Jan 18, 2023

Copy link
Copy Markdown
Contributor

I have created new test cases in s3tests repo that is maintained internally at linode.com to test this particular change

can you please contribute these tests in a pull request to the s3tests repo? we'd like to include them in our testing

@mattbenjamin

Copy link
Copy Markdown
Contributor

I have created new test cases in s3tests repo that is maintained internally at linode.com to test this particular change

can you please contribute these tests in a pull request to the s3tests repo? we'd like to include them in our testing

Yes, would definitely like an s3-tests PR here.

Matt

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cbodley

cbodley commented Jan 23, 2023

Copy link
Copy Markdown
Contributor

are there any reupload tests cases that would catch regressions here?

i found some existing coverage in test_multipart_upload_resend_part 👍

how do we check for orphaned rados objects/index entries?

this isn't a requirement for merge. i'd just like to come up with a plan that someone can work on for reef

it'd probably be easiest to add a python script under qa/workunits/rgw. there's a test_rgw_reshard.py (and run-reshard.sh wrapper) that could serve as an example

@jahschwa

jahschwa commented Jan 25, 2023 •

Copy link
Copy Markdown

can you please contribute these tests in a pull request to the s3tests repo? we'd like to include them in our testing

@cbodley @mattbenjamin to clarify, verifying the bug requires either RGW Admin Ops API access (to check bucket size accounting) and/or direct RADOS access (to look for orphaned objects); there's no way to do this via S3 API. Is this still something we'd want added to an S3 API compatibility test suite? I assume not. It's true yima77 added a test case to S3, but this was accomplished with an import rados.

@cbodley

cbodley commented Jan 25, 2023

Copy link
Copy Markdown
Contributor

Is this still something we'd want added to an S3 API compatibility test suite? I assume not.

@jahschwa agreed 100%. the s3tests suite should work against any s3-compatible service

Matt had mentioned our https://github.com/ceph/ragweed/ test suite above, which does 'import rados' and make calls to radosgw /admin APIs. but it's kinda specific to upgrade scenarios, and hasn't been used as a general test suite. it doesn't look like it currently shells out to rados or radosgw-admin commands, either

we've added some other one-off test cases under ceph/qa/workunits/rgw/, where we can run arbitrary shell/python scripts, including rados/radosgw-admin commands

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@yima77 looks great! needs a rebase, then we'll get it through qa for merge

@mattbenjamin

Copy link
Copy Markdown
Contributor

Is this still something we'd want added to an S3 API compatibility test suite? I assume not.

@jahschwa agreed 100%. the s3tests suite should work against any s3-compatible service

Matt had mentioned our https://github.com/ceph/ragweed/ test suite above, which does 'import rados' and make calls to radosgw /admin APIs. but it's kinda specific to upgrade scenarios, and hasn't been used as a general test suite. it doesn't look like it currently shells out to rados or radosgw-admin commands, either

we've added some other one-off test cases under ceph/qa/workunits/rgw/, where we can run arbitrary shell/python scripts, including rados/radosgw-admin commands

ok, sounds good

@cbodley

cbodley commented Jan 26, 2023

Copy link
Copy Markdown
Contributor

thanks @yima77, i'll follow up here with test results

@cbodley

cbodley commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

i'm still eager to test this, but i've been unable to get any jobs through teuthology this week. the sepia team is still working through network issues in the lab

@cbodley

cbodley commented Feb 9, 2023

Copy link
Copy Markdown
Contributor

@cbodley

cbodley commented Feb 14, 2023

Copy link
Copy Markdown
Contributor

still no luck getting any tests to run in teuthology

@cbodley

cbodley commented Feb 16, 2023

Copy link
Copy Markdown
Contributor

finally some test results! https://pulpito.ceph.com/cbodley-2023-02-16_14:01:19-rgw-wip-cbodley-testing-distro-default-smithi/

this shows some new s3test failures under rgw/dbstore, rgw/lifecycle, and rgw/crypt. but the same failures show up against other branches like https://pulpito.ceph.com/yuvalif-2023-02-12_19:47:07-rgw-wip-yuval-fix-58167-distro-default-smithi/ so i'm happy to approve this for merge 👍

@cbodley

cbodley commented Feb 16, 2023

Copy link
Copy Markdown
Contributor

thanks @mattbenjamin and @yima77!

the question now is whether we can backport this - obviously our users want the fix, but we also try to avoid cls format changes across minor versions. i feel like backports here would need some additional testing outside of the existing rgw and upgrade suites

@mattbenjamin

Copy link
Copy Markdown
Contributor

reef certainly, we should look at at least quincy?

@yima77

yima77 commented Feb 16, 2023

Copy link
Copy Markdown
Contributor Author

Internally, we patched v17.2.5 for this issue from this commit: yima77@ad260da

It doesn't go through cls route and uses sync update on the past prefix list.

@ormandj

ormandj commented Feb 17, 2023 •

Copy link
Copy Markdown
Contributor

I would make a very strong argument that a bug resulting in dark data/inconsistency between operations and resultant data on disk requires back-porting of the fix to any stable release that isn't EOLd for support/updates.

@cbodley

cbodley commented Feb 17, 2023

Copy link
Copy Markdown
Contributor

thanks @ormandj. above we discussed strategies for automated test coverage, but it's not clear who's working this. this also hasn't been through any upgrade suites yet; that will happen as part of reef's validation, but it won't test all the combinations of mismatched osd/rgw versions. cls changes like this have been a major source of bugs in the past, so i'd really like to have more test coverage to help mitigate the risk of backports

@cbodley

cbodley commented Feb 17, 2023

Copy link
Copy Markdown
Contributor

Matt had mentioned our https://github.com/ceph/ragweed/ test suite above, which does 'import rados' and make calls to radosgw /admin APIs. but it's kinda specific to upgrade scenarios, and hasn't been used as a general test suite. it doesn't look like it currently shells out to rados or radosgw-admin commands, either

ragweed has several existing test cases for multipart uploads, but none for part reupload. it would nice to add at least one test case for this, so we can build real upgrade tests for the mismatched osd/rgw versions

we've added some other one-off test cases under ceph/qa/workunits/rgw/, where we can run arbitrary shell/python scripts, including rados/radosgw-admin commands

during upgrades, we can't guarantee that we won't orphan any data (cls and rgw both need to coordinate that), so i don't think ragweed should do the scanning for orphans. a workunit is probably the best place for that

@cbodley

cbodley commented Feb 17, 2023

Copy link
Copy Markdown
Contributor

@cbodley cbodley mentioned this pull request Mar 14, 2023
3 tasks
@k0ste

k0ste commented Mar 14, 2023

Copy link
Copy Markdown
Contributor

I would make a very strong argument that a bug resulting in dark data/inconsistency between operations and resultant data on disk requires back-porting of the fix to any stable release that isn't EOLd for support/updates.

The backport tickets was created by bot, maybe @yima77 can backport this fixes, if this safe. Anyway this is more-less standard workflow for Ceph

@cbodley

cbodley commented Mar 14, 2023

Copy link
Copy Markdown
Contributor

i've added a discussion topic for tomorrow's weekly rgw meeting to https://pad.ceph.com/p/rgw-weekly about how to build the test coverage necessary to validate this PR and its backports. cc @ivancich who volunteered for https://tracker.ceph.com/issues/58780

@RaminNietzsche

Copy link
Copy Markdown
Member

@rhamon

rhamon commented Jun 8, 2023

Copy link
Copy Markdown

I'm sad to see this fix isn't in any release yet...
@cbodley @ivancich would you have any update for us please?

@cbodley

cbodley commented Jun 13, 2023

Copy link
Copy Markdown
Contributor

@cbodley @ivancich would you have any update for us please?

@rhamon working on test coverage in #50667

@cbodley

cbodley commented Oct 24, 2023

Copy link
Copy Markdown
Contributor

this and #50667 are now eligible for backports. who should be assigned to https://tracker.ceph.com/issues/59567 for quincy?

@k0ste

k0ste commented Oct 24, 2023

Copy link
Copy Markdown
Contributor

@cbodley somebody should give some permissions on Redmine fo @yima77. Currently impossible to assign Yixin Jin account

@microyahoo

microyahoo commented Dec 8, 2023 •

Copy link
Copy Markdown
Contributor

hi @cbodley @yima77, do you have plan to backport it to pacific?

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.