Skip to content

rgw: Fix shutdown/reload issues. - #68265

Closed
adamemerson wants to merge 27 commits into
ceph:mainfrom
adamemerson:wip-rgw-realm-reload-shutdown
Closed

adamemerson wants to merge 27 commits into
ceph:mainfrom
adamemerson:wip-rgw-realm-reload-shutdown

Conversation

@adamemerson

@adamemerson adamemerson commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Work through issues of shutting down RGW.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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

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

@adamemerson

Copy link
Copy Markdown
Contributor Author

@soumyakoduri Take a look at the restore part of this.

@adamemerson
adamemerson force-pushed the wip-rgw-realm-reload-shutdown branch 2 times, most recently from ddd482b to f286e05 Compare April 23, 2026 22:18
@adamemerson
adamemerson force-pushed the wip-rgw-realm-reload-shutdown branch 2 times, most recently from 2009e9a to 2e5de57 Compare April 30, 2026 04:33
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

adamemerson and others added 17 commits April 30, 2026 10:27
Thanks to Seena Fallah <[email protected]> for this fix, part of a
larger commit.

Fixes: https://tracker.ceph.com/issues/75164
Co-authored-by: Seena Fallah <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>
Rather than just dropping the reference, clean up the linger operation
properly within Objecter. Also, clear out handlers before
relinquishing reference to avoid use-after-free.

Fixes: https://tracker.ceph.com/issues/75164
Signed-off-by: Adam C. Emerson <[email protected]>
The response can be empty on some errors. Attempting to decode an
empty one loses the error value on valid errors. Also swallow any
decode errors.

Signed-off-by: Adam C. Emerson <[email protected]>
We were adding an overflow marker on every message above capacity, not
just the first, vitiating the purpose of the bound. The shame, the
shame.

Signed-off-by: Adam C. Emerson <[email protected]>
An error coming in after `maybe_cleanup()` is called could trigger it
again. Add a flag to prevent that.

Signed-off-by: Adam C. Emerson <[email protected]>
Add missing unwatch call.

Signed-off-by: Adam C. Emerson <[email protected]>
Leaving them out results in link errors on unoptimized debug builds.

Signed-off-by: Adam C. Emerson <[email protected]>
Unbreaks loading on `-O0` builds.

Signed-off-by: Adam C. Emerson <[email protected]>
test-rgw-multisite-single-cluster.sh sets up a single-cluster multisite
topology (two zones, one RADOS cluster) matching the teuthology
two-zonegroup layout. This is needed to reproduce reload deadlocks where
both RGWs pause frontends simultaneously.

test-rgw-period-reload-crash.py is a provocation script that hammers the
primary zone with concurrent S3 PUT traffic via boto3 while firing
period update commits to trigger realm reloads. It verifies reloads
actually fire (checks RGW log), detects both crashes and freezes, and
reports diagnostic info including core dump locations and gdb commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>
Without this we can end up in an infinite loop where we just fill the
log with -ECANCELED from `get_next()`.

Signed-off-by: Adam C. Emerson <[email protected]>
To prevent a race condition/crash on realm reload where sync was
trying to put objects through quota before quota was initialized.

Signed-off-by: Adam C. Emerson <[email protected]>
Ensure that every completion that has a reference to the driver is
drained before destroying the driver.

Signed-off-by: Adam C. Emerson <[email protected]>
RGW's can potentially deadlock with each other on realm-reload. Each
pauses its front-end then tries to join its thread with waiting
requests. To break the cycle, shut down the HTTP Manager and cancel
requests before joining.

Signed-off-by: Adam C. Emerson <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>
I won't block your PR over style nits, but I will fix them myself.

Signed-off-by: Adam C. Emerson <[email protected]>
So the namespace alias doesn't clash with the `rgw::asio` namespace.

Also reformat to deal with all the identifiers being longer.

Signed-off-by: Adam C. Emerson <[email protected]>
Destroying the entire coroutine frame on cancellation leaves in-flight
operations spawned by the `co_compose` with the frame they're
referencing destroyed.

Signed-off-by: Adam C. Emerson <[email protected]>
Logging functions accept null `DoutPrefixProvider*`s as no-ops. I had
considered logging to `std::cerr` `dout_emergency` style, but that
didn't seem consistent with the log priority for this message being
20.

Signed-off-by: Adam C. Emerson <[email protected]>
As I have noticed `use_blocked` creeping into the code base in places
it should not be, I am creating an ergonomic way to do the right
thing.

Signed-off-by: Adam C. Emerson <[email protected]>
In the attempt to use it as a completion token, give it an
executor. If there is no yield_context, use a strand on the system
executor, following practice in some parts of RGW.

Signed-off-by: Adam C. Emerson <[email protected]>
Create an abstraction over promise to provide similar functionality to
worker threads in Asio asynchronous form. Also include `ytask` and
`yrun_loop` for stackful coroutines.

Also add a few support functions.

Signed-off-by: Adam C. Emerson <[email protected]>
Split shutdown into asynchronous and synchronous. Asynchronous
cancellation (handled in the 'shutdown' function of the SAL) contains
only non-blocking operations.

Thread joins and similar should be reserved for synchronous shutdown,
currently handled in destruction/driver close.

For part one, since datalog was already using futures, adapt it to use
the new promise-based architecture.

We also use `co_throttle` during recovery as had been the original
intention (foiled by GCC 12 at the time) to limit memory pressure.

Signed-off-by: Adam C. Emerson <[email protected]>
Part of the shutdown/realm reload refactor, but generally something we
want anyway.

Also hook into the SAL shutdown idiom.

Signed-off-by: Adam C. Emerson <[email protected]>
@adamemerson
adamemerson force-pushed the wip-rgw-realm-reload-shutdown branch from 2e5de57 to 9942a36 Compare April 30, 2026 15:02
GCC 14 has issues with parenthesized `co_await` expressions, so
use a somewhat more unwieldy for loop instead of the while loop which was
honestly kind of unwieldy in the first place.

Signed-off-by: Adam C. Emerson <[email protected]>
Comment thread src/rgw/rgw_restore.cc
@@ -405,28 +396,25 @@ int Restore::process(int index, int max_secs, optional_yield y)

// Skip the entry of object/bucket which no longer exists
if (ret < 0 && (ret != -ENOENT))

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.

Don't we need unlock before all these return calls?

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

Overall restore module changes look good to me. Thanks @adamemerson

Comment thread src/rgw/rgw_restore.cc
{
std::lock_guard l{lock};
cond.notify_all();
worker.run();

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.

If we choose to increase workers count in future, can all these changes (related to worker strand) be just applied in a loop? Or would they need any additional synchronization ?

@@ -1088,6 +1088,10 @@ RGWRados::shutdown(rgw::shutdown_vector& to_wait)
svc.async_processor->set_down_flag();
}

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.

Restore background task relies on async_processor for some of its background tasks like list(), trim() etc right! Is it ok to stop the async_processor before stopping the restore worker?

In the current main code, async_processor is stopped before shutting down restore worker. Just checking if that may have been reason for some of the valgrind errors reported in shutdown code-path (https://tracker.ceph.com/issues/72772) and if that will get addressed with this change.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Aug 9, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution!

@github-actions github-actions Bot closed this Sep 8, 2026
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.

2 participants