Skip to content

qa/rados: bound client hangs with rados_osd_op_timeout - #71861

Merged
ronen-fr merged 1 commit into
ceph:mainfrom
ronen-fr:wip-rf-radosbnto
Sep 28, 2026
Merged

ronen-fr merged 1 commit into
ceph:mainfrom
ronen-fr:wip-rf-radosbnto

Conversation

@ronen-fr

Copy link
Copy Markdown
Contributor

Without a client-side deadline, a cluster that stops serving I/O parks the job in
librados until max_job_time kills it hours later, attributed to nothing. Set 900s
in qa/config/rados.yaml (17 rados sub-suites; same value the fs suites already use),
with rados/verify carved out at 3600s since it runs under memcheck.

Without a client-side deadline, a cluster that stops serving I/O parks
the job in librados until max_job_time kills it hours later, attributed
to nothing. Set 900s in qa/config/rados.yaml (17 rados sub-suites; same
value the fs suites already use), with rados/verify carved out at 3600s
since it runs under memcheck.

Assisted-by: Claude
Signed-off-by: Ronen Friedman <[email protected]>
Comment thread qa/config/rados.yaml
# (qa/cephfs/conf/client.yaml); it is several times longer than the
# longest stall any thrasher here induces on purpose (~125s for
# test_pool_min_size, 80s for the injected pauses).
rados osd op timeout: 900

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.

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath25-testing-20260918.001212-main.

@ronen-fr

Copy link
Copy Markdown
Contributor Author

Failed Teuthology, due to an actual problem in the Objecter and the tests, that causes ops to be transmitted out-of-order:

This breaks rados_cls_all: OSDs abort with "out of order op"

Both tasks/rados_cls_all jobs in skanta-2026-09-20_00:25:34-rados-wip-bharath25-testing-20260918.001212-main-distro-default-trial (570014, 570025) failed with the same OSD crash, and I traced it back to the rados osd op timeout: 900 added here.

What the job reports vs. what happened

The reported failure is three layers removed from the defect:

failure_reason: Command failed (workunit test cls/test_cls_2pc_queue.sh) on trial043
                with status 124   # timeout 3h

The actual first event, 3 hours earlier:

2026-09-20T00:40:22 osd.3 pg_epoch: 30 pg[3.7(...) [3,7] r=0 ... active+clean]
    bad op order, already applied 5616 > this 5615
./src/osd/PrimaryLogPG.cc: 4454: ceph_abort_msg("out of order op")

osd.3 (primary of 3.7) aborts during TestCls2PCQueue.MultiReserve/Replicated. osd.7 then takes over 3.7 as sole primary and aborts identically 1.2s later (already applied 5633 > this 5632). Two of eight OSDs down, PG 3.7 unavailable.

This is the osd_debug_op_order check. It defaults to false but is set to true for every teuthology job by qa/tasks/ceph.conf.template:57, so it only ever fires in QA.

The client genuinely sent the ops out of order

Same connection, consecutive messenger sequence numbers:

seq 1244 <== client.4506 ... osd_op(client.4506.0:5616 3.7 ...)
seq 1245 <== client.4506 ... osd_op(client.4506.0:5615 3.7 ...)

tid 5616 went on the wire before tid 5615. Not an OSD-side reorder, not a msgr reorder — librados submitted them inverted.

Why: rados_osd_op_timeout moves tid assignment out from under the session lock

Normally Objecter::_op_submit() assigns the tid and calls _send_op() both under s->lock, so per-session tid order == wire order:

// src/osdc/Objecter.cc ~2665
unique_lock sl(s->lock);
if (op->tid == 0) op->tid = ++last_tid;
...
if (need_send) _send_op(op);

But when a client op timeout is configured, the tid is claimed much earlier and outside that lock, in _op_submit_with_budget():

// src/osdc/Objecter.cc ~2441
if (osd_timeout > timespan(0)) {
  if (op->tid == 0) op->tid = ++last_tid;     // <-- no session lock held
  op->ontimeout = timer.add_event(osd_timeout, ...);
}

osd_timeout is populated directly from rados_osd_op_timeout (Objecter.cc:5484, and the observer at :251).

Between that early assignment and s->lock sit _take_op_budget() (can block and drop the rwlock), timer.add_event(), SplitOp::create(), _calc_target() and _get_session() (can relock). last_tid is std::atomic, so there is no data race — just a wide window in which a thread holding a later tid overtakes one holding an earlier tid.

TestCls2PCQueue.MultiReserve is exactly the workload that exercises this: 10 threads sharing one IoCtx, each doing synchronous ioctx.operate() against the same object. 570025 shows a 2-tid skew (5636 > 5634), which is consistent with a race rather than a one-off.

Correlation

jobs rados osd op timeout result
570014, 570025 — both rados_cls_all jobs in this run 900 fail, bad op order
570155, 572413, 572660 — rados_cls_all, Sep 20–21 absent pass, 10–16 min

The value doesn't matter, only that it is non-zero — 570025 is a rados/verify job, so the valgrind carve-out in this PR doesn't apply to it anyway (it uses validater/lockdep), and it hit the same abort at 900.

Bonus: the timeout inverted the goal of this patch here

With 3.7 dead the client blocked. The daemon watchdog barked at 00:45:33 and killed all daemons. Each librados call then sat out its full 900s before returning -ETIMEDOUT: reserves at 00:55:23, list_reservations at 01:10:23, then rados_nobjects_list_next2: Connection timed out in every subsequent SetUp()/TearDown() — 1800s burned per remaining test case — until timeout 3h killed the workunit at 03:40:12.

So in this case the deadline turned one fast hang into a slow 900s-per-call grind that still consumed the whole job budget and still got attributed to the workunit rather than to the OSD crash.

Suggested resolution

  1. Objecter fix (the real one): stop pre-assigning the tid. Defer arming the timeout until after the tid is assigned under s->lock in _op_submit() — e.g. set op->ontimeout right after _session_op_assign(). The split path already assigns its own tid under splitop_session->lock (add_op_to_splitop_session()), so it is unaffected. This restores the per-session tid/send ordering invariant that osd_debug_op_order — and librados' same-object ordering guarantee — depends on.
  2. Unblock QA meanwhile: hold or narrow this patch. As written it will crash OSDs in any rados sub-suite that runs multi-threaded same-object writes, not just rados_cls_all.

Worth deciding separately, but I'd keep it out of scope here: whether osd_debug_op_order is the right assertion for 10 independent threads issuing concurrent unordered ops, where relative tid order is an artifact rather than a semantic commitment. It has held for years without the timeout, so I'd treat the Objecter window as the bug rather than relax the check.

@ronen-fr

Copy link
Copy Markdown
Contributor Author

I will be merging this, now that #71984 is approved and passed my Teuthology tests
(actually - 71984 and this one were also tested together. The cla test issue was indeed solved).

@ronen-fr ronen-fr removed the DNM label Sep 28, 2026
@ronen-fr
ronen-fr merged commit 728e055 into ceph:main Sep 28, 2026
17 of 18 checks passed
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