Skip to content

rgw: fix data corruption caused by repeated uploadPart requests when race condition - #55042

Closed
thenamehasbeentake wants to merge 1 commit into
ceph:mainfrom
thenamehasbeentake:fix-uploadpart
Closed

thenamehasbeentake wants to merge 1 commit into
ceph:mainfrom
thenamehasbeentake:fix-uploadpart

Conversation

@thenamehasbeentake

@thenamehasbeentake thenamehasbeentake commented Jan 2, 2024 •

Copy link
Copy Markdown

rgw: fix data corruption caused by repeated uploadPart requests when race condition

We should delete the object in the "shadow" namespace first and then in the "multipart" namespace at the end to avoid race condition referenced from #11749
The bug was once fixed here and reintroduced now

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

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
  • jenkins test rook e2e

…race condition

We should delete the object in the "shadow" namespace first and then in the "multipart" namespace to avoid race condition referenced from ceph#11749

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

Signed-off-by: xiaobaowen <[email protected]>
@thenamehasbeentake
thenamehasbeentake requested a review from a team as a code owner January 2, 2024 09:36
@github-actions github-actions Bot added the rgw label Jan 2, 2024
Comment on lines -201 to +203
for (const auto& obj : written) {
if (raw_head && obj == *raw_head) {
ldpp_dout(dpp, 5) << "NOTE: we should not process the head object (" << obj << ") here" << dendl;
for (auto obj = written.rbegin(); obj != written.rend(); obj++) {
if (raw_head && *obj == *raw_head) {
ldpp_dout(dpp, 5) << "NOTE: we should not process the head object (" << *obj << ") here" << dendl;

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.

thanks @thenamehasbeentake

i'm having trouble understanding why this needs to loop in reverse. for multipart uploads, it's the raw_head object that we want delete last. we already skip that object in the loop and handle it below

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.

ok, i think i understand this now

for multipart uploads, raw_head points at the final multipart object name rather than the current part's head object, so this logic doesn't guarantee that the part head object gets deleted last

i uploaded a multipart object testbucket/128m.iso with some extra debug logging, and the part uploads show:

req 14841384554456452370 0.075002573s s3:put_obj raw_head default.rgw.buckets.data:1cf80de1-4e97-4a8f-89d2-747f9b8c432f.4143.1_128m.iso

i pushed a fix in #55582 and there i see the correct part head:

req 17160862790303507845 0.070002414s s3:put_obj raw_head default.rgw.buckets.data:8ec2917b-cefa-45a9-b342-3d285fc73685.4143.1__multipart_128m.iso.2~6HwU84cYMDBfu7p-hOWb4ReeAhCMHRz.2

because of this bug, reversing the order of deletion does help 👍 but i'd rather fix that head_obj detection to stay consistent with the comment history just above

@mkogan1
mkogan1 self-requested a review February 14, 2024 11:49

@mkogan1 mkogan1 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.

@ivancich ivancich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I propose we close this PR without merge given that #55582 narrows the issue to the root cause and is not dependent on how elements of a set are sorted. That PR also corrects a fundamental confusion in the code.

@ivancich

Copy link
Copy Markdown
Member

Thank you, @thenamehasbeentake . The reproducer in the tracker and this PR really helped us zero in on the ultimate problem and was instrumental in creating and testing the alternate PR. This is great work!

@ivancich
ivancich requested a review from mkogan1 February 14, 2024 16:09
@cbodley

cbodley commented Feb 14, 2024

Copy link
Copy Markdown
Contributor

@thenamehasbeentake thanks for the contribution!

@cbodley cbodley closed this Feb 14, 2024
@thenamehasbeentake

Copy link
Copy Markdown
Author

I propose we close this PR without merge given that #55582 narrows the issue to the root cause and is not dependent on how elements of a set are sorted. That PR also corrects a fundamental confusion in the code.

Thank you for fixing the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants