Project

General

Profile

Actions

Bug #80906

open
KB KB

rgw: a conditional request that loses the race is answered success, or 500

Bug #80906: rgw: a conditional request that loses the race is answered success, or 500

Added by Kyle Bader 2 months ago. Updated 2 months ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
tentacle, umbrella
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

Found with the conditional-request extension of the P model of RGW overwrites, and reproduced on main at 44d50f6abb9 on a single-host vstart cluster with the injection points in injection points and new cases in the qa workunit qa workunit. By code review the same code is in tentacle.

A conditional write that loses the race for the head write is answered as
done_cancel maps the error, and the mapping is wrong both ways:

  • With If-Match: *, -ECANCELED becomes success (rgw_rados.cc:3752-3753),
    though the write never happened. Racing a PutObject with If-Match on the old
    ETag, both are answered 200 while the head holds the other write, and no order
    of the two requests explains both answers.
  • With If-Match on an ETag, -ECANCELED has no S3 error and is answered 500
    UnknownError (rgw_common.cc, set_req_state_err).

With the delete guard of ceph/ceph#72100, a conditional DeleteObject that loses
its guard is answered 204 the same way (rgw_op.cc:6101-6103), which is right
for an unconditional delete but not for one with a condition.

AWS S3 answers a conditional request that loses to a concurrent operation with
409 ConditionalRequestConflict. Doing the same for a conditional PutObject,
CompleteMultipartUpload or DeleteObject that loses its guard closes this in the
model.

Reproducers: workunit cases test_conditional_puts_race (If-Match and
If-Match: * PutObjects, both held at write_meta_before_head_write; both
answered 200, head holds the first) and test_if_match_losing_race (an If-Match
PutObject loses to a PutObject and is answered 500). Both fail on main and with
the fixes proposed so far.

KB Updated by Kyle Bader 2 months ago Actions #1

  • Pull request ID set to 72109

KB Updated by Kyle Bader 2 months ago Actions #2

An s3-tests reproducer for the 500: test_put_object_if_match_racing_put_if_match in s3-tests (marker rgw_inject, with rgw_inject_delay_pattern = write_meta_before_head_write). Two PutObjects with If-Match on the same ETag each check their condition, then wait before the head write. The loser is answered 500 UnknownError (-ECANCELED); S3 answers 412 or 409 ConditionalRequestConflict.

With default retries, the SDK retries the 500 and the retry is answered 412. So a client sees 412 after two attempts, while the gateway's logs and metrics show the 500. The test makes a single attempt.

The P model's new S3Answers spec also checks the answers: on main it reports this 500 for PutObject and CompleteMultipartUpload, and with #72109 the answers hold.

MH Updated by Matthew Heler 2 months ago Actions #3

  • Status changed from New to Fix Under Review
  • Assignee set to Kyle Bader
  • Backport changed from tentacle to tentacle, umbrella

YO Updated by Yuma Ogami 2 months ago Actions #4

Hi,
Is this race condition realistically achievable in a normal production environment under high concurrency, or is it practically limited to test setups with artificial delays?
Thanks!

Actions

Also available in: PDF Atom