Skip to content

librados/asio: clear cancellation slot in associated executor - #68873

Merged
cbodley merged 2 commits into
ceph:mainfrom
cbodley:wip-73475
May 21, 2026
Merged

cbodley merged 2 commits into
ceph:mainfrom
cbodley:wip-73475

Conversation

@cbodley

@cbodley cbodley commented May 12, 2026

Copy link
Copy Markdown
Contributor

the librados callback function AsyncOp::aio_dispatch() runs on Objecter's finisher strand executor, and dispatches the completion handler to its associated executor

asio cancellation is not thread-safe, so should be synchronized on that associated executor. move the call to slot.clear() from that librados callback into the AsyncHandler wrapper so it doesn't run until we've switched to the correct executor

because our op_cancellation handler depends on an AioCompletion pointer, we have to clear the cancellation slot before that AioCompletion lifetime ends

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

Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions github-actions Bot added the core label May 12, 2026
@cbodley
cbodley marked this pull request as ready for review May 12, 2026 19:45
@cbodley
cbodley requested a review from a team as a code owner May 12, 2026 19:45
@cbodley
cbodley requested review from adamemerson and smanjara May 12, 2026 19:45
@cbodley cbodley added the rgw label May 12, 2026
@cbodley
cbodley requested a review from mkogan1 May 12, 2026 20:05
@adamemerson adamemerson self-assigned this May 12, 2026
@adamemerson

Copy link
Copy Markdown
Contributor

jenkins retest this please

@adamemerson adamemerson removed their assignment May 13, 2026
@adamemerson

Copy link
Copy Markdown
Contributor

jenkins test signed

@djgalloway

Copy link
Copy Markdown
Contributor

jenkins test windows

Comment thread src/librados/librados_asio.h Resolved
@smanjara

smanjara commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Linking the integration test here reproducing the cancellation slot race along with the TSAN report. https://pad.ceph.com/p/q8z36PhuRaQMohpejX7b. With this PR, the testcase passes successfully.

@smanjara

Copy link
Copy Markdown
Contributor

@cbodley the squash commit needs your signoff.

@smanjara
smanjara self-requested a review May 14, 2026 17:53
cbodley added 2 commits May 18, 2026 13:31
pass the unique_aio_completion_ptr into a wrapped completion handler to
extend its lifetime past the end of the AsyncOp::aio_dispatch() callback

Signed-off-by: Casey Bodley <[email protected]>
the librados callback function `AsyncOp::aio_dispatch()` runs on
Objecter's finisher strand executor, and dispatches the completion
handler to its associated executor

asio cancellation is not thread-safe, so should be synchronized on that
associated executor. move the call to `slot.clear()` from that librados
callback into the AsyncHandler wrapper so it doesn't run until we've
switched to the correct executor

because our `op_cancellation` handler depends on an `AioCompletion`
pointer, we have to clear the cancellation slot before that
`AioCompletion` lifetime ends

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

Signed-off-by: Casey Bodley <[email protected]>
@cbodley

cbodley commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

from windows build https://jenkins.ceph.com/job/ceph-windows-pull-requests/78703/consoleFull

error: no viable constructor or deduction guide for deduction of template arguments of 'AsyncHandler'
auto p = Completion::create(ex1, AsyncHandler{std::move(handler)});

i added a constructor to AsyncHandler

@cbodley

cbodley commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

@cbodley
cbodley merged commit 30a1b94 into ceph:main May 21, 2026
6 checks passed
@cbodley
cbodley deleted the wip-73475 branch May 21, 2026 14:41
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/26233126359

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