Skip to content

rgw, qa: test injection points and a workunit for overwrite races - #72096

Open
mmgaggle wants to merge 5 commits into
ceph:mainfrom
mmgaggle:wip-rgw-overwrite-race-tests
Open

mmgaggle wants to merge 5 commits into
ceph:mainfrom
mmgaggle:wip-rgw-overwrite-race-tests

Conversation

@mmgaggle

@mmgaggle mmgaggle commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Reproducers for races between writers of one key that leak RADOS objects or lose data, found with a formal model of RGW overwrites and multipart uploads (https://github.com/mmgaggle/ceph/tree/cdbbbb09245535782e91503ad45b0cc7a423e10d/src/test/formal/p/rgw_overwrite).

  • rgw_inject_delay() holds a request at a named point when rgw_inject_delay_pattern names it and rgw_inject_delay_sec is positive; a request coroutine waits on a timer, so the frontend keeps serving. Points: write_meta_before_head_write, copy_obj_before_write_meta, complete_mp_after_head_write, delete_obj_before_head_delete.
  • rgw_debug_inject_mp_meta_delete_err makes a multipart completion's delete of its meta object fail, after the head write.
  • qa/workunits/rgw/test_rgw_overwrite_races.py: each case holds one request at a point while another changes the key, then deletes every key, drains GC, and expects no RADOS object of the bucket to remain (or the object to read back whole). It sets its knobs at runtime with ceph config set.
Case Tracker Fix
test_losing_complete https://tracker.ceph.com/issues/80897 rgw: a completion that loses the head race sends its parts to GC
test_delete_racing_put https://tracker.ceph.com/issues/80898 rgw: guard a delete's head removal on the ID tag it read
test_losing_copy https://tracker.ceph.com/issues/80899 rgw: a copy that loses the head race drops its tail references
test_delete_racing_dedup, test_copy_to_itself_racing_dedup https://tracker.ceph.com/issues/80901 open

Every case fails on main, and passes with its fix on a vstart cluster. The workunit is not added to a qa suite yet, since the dedup cases fail until https://tracker.ceph.com/issues/80901 is addressed. s3-tests counterparts, for https://tracker.ceph.com/issues/80895, https://tracker.ceph.com/issues/80896, https://tracker.ceph.com/issues/80900 and https://tracker.ceph.com/issues/80903, are in https://github.com/mmgaggle/s3-tests/tree/wip-rgw-overwrite-races.

Four cases for conditional requests, added later:

Case Tracker Fix
test_cond_delete_racing_put https://tracker.ceph.com/issues/80898 #72100
test_conditional_puts_race https://tracker.ceph.com/issues/80906 #72109
test_if_match_losing_race https://tracker.ceph.com/issues/80906 #72109
test_refused_complete_keeps_parts https://tracker.ceph.com/issues/80907 #72109

Versioned buckets and other scenarios

The injection points and the workunit now cover versioned buckets. The existing points miss versioned races, because a versioned write links its version to the olh after its head write, and a versioned DeleteObject links a delete marker or unlinks a version without reaching delete_obj_before_head_delete.

  • New points: write_meta_before_olh_link, delete_obj_before_olh_link, delete_obj_before_unlink_instance and unlink_instance_before_olh_update.
  • rgw_inject_delay_pattern accepts a comma-separated list of points, so a case can hold two requests at different points.
  • New option rgw_debug_inject_link_olh_log_err_key: the olh link of that object name fails after the bucket index links the version.
  • The workunit can create a bucket with versioning enabled or suspended. With versioning suspended, each key first gets an olh, so its null version shares the olh's head object. Cleanup removes every version and delete marker.
  • The seven head-race cases also run with versioning suspended. New cases cover conditional writes and deletes racing at the olh link, two If-None-Match writes of a null version, a DeleteObject of the null version racing a PutObject, olh link failures, a copy onto itself in a suspended bucket and racing a tagging or ACL update, and a listing during a stalled PutObject in versioned buckets.

The workunit passes with the whole series applied. Its versioned cases need the versioning follow-ups on #72098, #72100, #72101, #72103, #72115 and #72118, and it expects the 409 answers of #72109 and #72118.

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)

rgw_inject_delay() holds a request at a named point when
rgw_inject_delay_pattern names it and rgw_inject_delay_sec is positive.
A request coroutine waits on a timer, so the frontend keeps serving
other requests meanwhile. The points:

- write_meta_before_head_write: every head write, before its OSD op
- copy_obj_before_write_meta: a copy, after it reads the source
- complete_mp_after_head_write: a multipart completion, after its head
  write and before it deletes the meta object
- delete_obj_before_head_delete: a delete, after it reads the head and
  before it prepares its index op

rgw_debug_inject_mp_meta_delete_err makes a multipart completion's
delete of its meta object fail with that errno, after the head write.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
Each case holds one request at an injection point while another request
changes the same key. It then deletes every key, drains GC and expects
no RADOS object of the bucket to remain:

- test_losing_complete: a completion that loses the head write to a
  PutObject leaks its parts
- test_delete_racing_put: a DeleteObject, which has no ID-tag guard,
  removes a newer head and leaks its tail
- test_losing_copy: a copy that loses the head write keeps its
  references on the source's tail
- test_delete_racing_dedup: a delete that read the head before dedup
  rewrote it leaks the source's tail
- test_copy_to_itself_racing_dedup: a copy onto itself writes back a
  tail that dedup freed, and the object no longer reads

Every case fails on main. A case whose race does not play out as
arranged reports itself inconclusive rather than passing.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Config Diff Tool Output

+ added: rgw_debug_inject_link_olh_log_err_key (rgw.yaml.in)
+ added: rgw_debug_inject_mp_meta_delete_err (rgw.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@mmgaggle
mmgaggle marked this pull request as ready for review September 26, 2026 08:00
@mmgaggle
mmgaggle requested a review from a team as a code owner September 26, 2026 08:00
Four cases, each holding one request at an injection point:

- test_cond_delete_racing_put: a DeleteObject with If-Match removes an
  object that a PutObject wrote after the delete checked the ETag
  (https://tracker.ceph.com/issues/80898)
- test_conditional_puts_race: an If-Match PutObject and an If-Match: *
  PutObject are both answered success while the head holds the first
  (https://tracker.ceph.com/issues/80906)
- test_if_match_losing_race: an If-Match PutObject that loses the race
  is answered 500 (https://tracker.ceph.com/issues/80906)
- test_refused_complete_keeps_parts: a completion with If-None-Match: *
  refused with 412 drops its parts from the bucket index, though its
  upload stays (https://tracker.ceph.com/issues/80907)

All four fail on main; the first passes with the delete guard.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
In a versioned bucket a write links its version to the olh after its head
write, and a DeleteObject links a delete marker or unlinks a version
without removing a head, so the existing points miss those races. Add:

- write_meta_before_olh_link: a versioned write, after its head and index
  entry are written, before it links the olh
- delete_obj_before_olh_link: a DeleteObject without a version id, after
  it checks the current version, before it links its delete marker
- delete_obj_before_unlink_instance: a DeleteObject of a version, after it
  reads and checks the version's index entry, before it unlinks it
- unlink_instance_before_olh_update: a DeleteObject of a version, after
  the index unlinks it and logs its removal, before the olh log is applied

rgw_inject_delay_pattern may now name several points, separated by
commas, so that a case can hold two requests at different points.

rgw_debug_inject_link_olh_log_err_key makes the olh link of a write or
delete of that object name fail after the bucket index has linked the
version, as a bilog flush that fails there would.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
The overwrite-race cases ran only in buckets that are not versioned.
Versioned buckets take other paths: a write links its version to the
olh after its head write, a DeleteObject links a delete marker or
unlinks a version, and with versioning suspended the null version shares
the key's head object with the olh.

Bucket setup and cleanup:
- new_bucket() can enable or suspend versioning. With versioning
  suspended it first gives each key an olh, a version and a delete
  marker written while versioning was enabled.
- check_no_leaks() deletes every version and delete marker.
- config() sets options for the duration, globally, since the OSDs read
  rgw_pending_bucket_index_op_expiration in cls_rgw.
- etag() answers None for a head that lost its object's attributes.

Cases:
- the seven head-race cases again with versioning suspended
  (<case>_suspended);
- a PutObject with If-Match, or a DeleteObject with If-Match, racing a
  PutObject at the olh link, with versioning enabled; a loser must be
  answered 409;
- two PutObjects with If-None-Match: * of a null version; one wins, the
  key reads back as its object, and the loser is answered 409;
- a DeleteObject of the null version racing a PutObject that links after
  the removal is logged;
- an olh link that fails after the index links the version, for a
  PutObject (enabled, suspended) and a CompleteMultipartUpload;
- a copy onto itself while a non-null version is current, of the null
  version, and racing a tagging or an ACL update;
- a listing during a stalled PutObject, with versioning enabled and
  suspended, checked with ListObjects and ListObjectVersions.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
@dvanders

Copy link
Copy Markdown
Contributor

I ran this series on a single-host vstart cluster (1 OSD, 1 RGW, RelWithDebInfo) to see how often the conditional-write races happen without the injection points.

Test: 8 clients released together on one key, 330 rounds per cell (300 with 1 KiB bodies, 30 with 6 MiB). "Rounds with more than one 200" should be 0.

Bucket, request this PR's head (no fixes) + #72109 #72118 alone
unversioned, If-None-Match: * 0 0 0
unversioned, If-Match: <etag> 0, but 67% of losers answered 500 0, losers 409 or 412 0, losers still 500
versioning enabled, If-None-Match: * 329 330 0
versioning enabled, If-Match: <etag> 330 330 0

Versioning-suspended buckets behaved like unversioned ones. In no round was the final object anything but a write that was answered 200.

So on a versioning-enabled bucket the race in #72118 needs no special timing: nearly every contended round has several winners, and with #72118 exactly one. On unversioned buckets #72109 turns the 500s into 409/412.

The workunit here: 6 pass / 22 fail / 1 inconclusive on this PR's head, 16 / 12 / 1 with #72109 merged in (test_conditional_puts_race, test_if_match_losing_race, test_cond_delete_racing_put, test_refused_complete_keeps_parts and the suspended variants now pass; the rest need the other PRs).

Not tested: #72109 and #72118 together (they conflict in rgw_rados.cc), a release branch, multisite, and conditional multipart completion without injection.

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