Skip to content

tentacle: rgw: Fix crashes on realm reload - #70262

Merged
batrick merged 8 commits into
ceph:tentaclefrom
adamemerson:wip-76094-tentacle
Jul 22, 2026
Merged

batrick merged 8 commits into
ceph:tentaclefrom
adamemerson:wip-76094-tentacle

Conversation

github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Jul 16, 2026
@adamemerson adamemerson removed the releng-audit-fail Release engineering: failed backport verification audit. label Jul 16, 2026
github-actions[bot]

This comment was marked as outdated.

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Jul 16, 2026
@adamemerson

Copy link
Copy Markdown
Contributor Author

/audit override

@github-actions github-actions Bot added releng-audit-override and removed releng-audit-fail Release engineering: failed backport verification audit. labels Jul 16, 2026
@github-actions

Copy link
Copy Markdown

✅ Audit Override Applied by @adamemerson.

View workflow run

BBoozmen and others added 8 commits July 16, 2026 14:43
… header

Just like rgw_asio_frontend_timer.h, factor out the Connection struct and
ConnectionList class from the anonymous namespace in rgw_asio_frontend.cc
to a new header rgw_asio_frontend_connection.h (under namespace rgw::asio).

This is especially needed to get better coverage thru unittesting.

This is non-functional: no logic changes, the types, methods, and behavior
are identical as before. The frontend .cc uses type aliases to maintain the
same unqualified names.

Signed-off-by: Oguzhan Ozmen <[email protected]>
(cherry picked from commit 222a393)
Fixes: https://tracker.ceph.com/issues/78307
Signed-off-by: Adam C. Emerson <[email protected]>
ConnectionList::close() is called from the main thread during
AsioFrontend::stop(), but io_context pool threads may still have
pending async_write operations on those sockets. The old code called
socket.close() which is a boost::asio thread-safety violation:

  - it NULLifies descriptor_data in the epoll reactor which causes
    concurrent start_op calls to dereference NULL (SIGSEGV), or
  - it deregisters the fd from epoll, orphaning pending operations so
    their completion handlers would never fire (hang)

Fix by using socket.cancel() + native ::shutdown():
- cancel() dequeues pending operations from the reactor's
  per-descriptor queue and adds completions with
  operation_aborted. This should handle writes blocked in epoll.
- shutdown(fd, SHUT_RDWR) disables the transport so any
  strand-queued writes that haven't entered epoll yet will fail
  with EPIPE on the next send() attempt

Also remove connections.clear() since coroutines exited via I/O error
and their RAII Guard removes them from the list on destruction.

This follows the same principle as the fix for
https://tracker.ceph.com/issues/58670 which handles the same scenario
in timeout_handler path.

Bottomlime, socket operations must not be performed from outside the owning
strand.

Fixes: https://tracker.ceph.com/issues/77658
Signed-off-by: Oguzhan Ozmen <[email protected]>
(cherry picked from commit 15915c8)
Fixes: https://tracker.ceph.com/issues/78307
Signed-off-by: Adam C. Emerson <[email protected]>
This is meant to be used in unittesting.

Signed-off-by: Oguzhan Ozmen <[email protected]>
(cherry picked from commit 179b873)
Fixes: https://tracker.ceph.com/issues/78307
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()`. Duplicates a check in the
`blocked_operations` loop.

Fixes: https://tracker.ceph.com/issues/76094
Signed-off-by: Adam C. Emerson <[email protected]>
(cherry picked from commit 17f994f)
Fixes: https://tracker.ceph.com/issues/78122
Signed-off-by: Adam C. Emerson <[email protected]>
Previously if we received an rvalue function object we would call a
moved-from object on all but the first thread. In practice this didn't
cause an issue, but only because of the functions we were passing.

Fixes: https://tracker.ceph.com/issues/76094
Signed-off-by: Adam C. Emerson <[email protected]>
(cherry picked from commit 3ab380f)
Fixes: https://tracker.ceph.com/issues/78122
Signed-off-by: Adam C. Emerson <[email protected]>
AsioFrontend::pause() (and stop()) call ConnectionList::close() from
the realm reloader thread. That invokes socket.close() on every live
connection from a thread that isn't the connection's asio strand, so
the reactor deregisters each socket's descriptor_state racing against
the coroutine that handles the connection. If a keep-alive connection
is starting its next async_read_some() on its strand at the same time,
epoll_reactor::start_op() dereferences the descriptor_state that close
has already freed and radosgw segfaults in an io_context_pool thread.

This matches the race pattern fixed for timeout_timer in 86ad0b8:
any caller that touches socket state from outside the strand needs to
be serialized with the coroutine.

Store the coroutine's strand executor on Connection and dispatch the
close onto that strand in ConnectionList::close(). The lambda captures
an intrusive_ptr to Connection so the object lives until the close
actually runs, since connections.clear() unlinks the list entry right
after dispatch.

Tracker: https://tracker.ceph.com/issues/76094
Signed-off-by: Lumir Sliva <[email protected]>

Update `unittest_rgw_asio_frontend` to run the `io_context` and
execute in a coroutine to match the environment in RGW.

Signed-off-by: Adam C. Emerson <[email protected]>
(cherry picked from commit 1430b88)

Conflicts:
	src/rgw/rgw_asio_frontend.cc
 - `sal_ctx` capture on main does not exist in tentacle

Fixes: https://tracker.ceph.com/issues/78122
Signed-off-by: Adam C. Emerson <[email protected]>
@github-actions

Copy link
Copy Markdown

⚠️ Audit Override Removed

New commits were pushed to this PR, so the previous override has been removed.

View workflow run

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ceph Release Engineering Audit Report

Automated Backport Parity Review

⚠️ Multiple Original PRs Detected: PR #68920, PR #69713

Discrepancies detected between the backport PR and the original source PR(s). Please see the Commit Parity Visualizer below.


Commit Parity Visualizer

BACKPORT PR #70262 SOURCE PR SOURCE STATUS
b7d95fe rgw: Check going_down in other-than-interval_set loop PR #68920 17f994f rgw: Check going_down in other-than-interval_set loop
ceca93f rgw/rados: Initialize things before starting threads that use them e8639cc rgw/rados: Initialize things before starting threads that use them
<<<< MISSING IN BACKPORT >>>> 3a09906 rgw: Fix name and add operators for io_context holder
5353963 common/async: io_context_pool no longer moves from init function 3ab380f common/async: io_context_pool no longer moves from init function
f411a82 rgw/beast: dispatch connection close on strand during pause 1430b88 rgw/beast: dispatch connection close on strand during pause
5deac46 rgw/beast: (non-functional) refactor Connection and ConnectionList to header PR #69713 222a393 rgw/beast: (non-functional) refactor Connection and ConnectionList to header
bc9d8a1 rgw/beast: fix shutdown crash in ConnectionList::close() 15915c8 rgw/beast: fix shutdown crash in ConnectionList::close()
e3068e1 rgw/beast: (non-functional change) add size method to ConnectionList 179b873 rgw/beast: (non-functional change) add size method to ConnectionList
030135e test/rgw/beast: add unit test for ConnectionList shutdown behavior 19748f1 test/rgw/beast: add unit test for ConnectionList shutdown behavior

Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations

⚠️ WARNING: Cherry-pick conflicts or deviations were found that require component lead review.

A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.

This does not necessarily indicate an issue but a maintainer should review.

**Click to expand conflict summaries.**

Deviation in Backport f411a82 (cherry-pick of 1430b88)

Affected File(s)

Range Diff

Click to expand
--- Original (1430b885)
+++ Backport (f411a828)
@@ -26,3 +26,11 @@
 execute in a coroutine to match the environment in RGW.
 
 Signed-off-by: Adam C. Emerson <[email protected]>
+(cherry picked from commit 1430b8855352b4d682e1186005861f18e9eb7e45)
+
+Conflicts:
+	src/rgw/rgw_asio_frontend.cc
+ - `sal_ctx` capture on main does not exist in tentacle
+
+Fixes: https://tracker.ceph.com/issues/78122
+Signed-off-by: Adam C. Emerson <[email protected]>

================================================================================
RANGE DIFF
================================================================================

1:  1430b885535 ! 1:  f411a828718 rgw/beast: dispatch connection close on strand during pause
    @@ Commit message
         execute in a coroutine to match the environment in RGW.
     
         Signed-off-by: Adam C. Emerson <[email protected]>
    +    (cherry picked from commit 1430b8855352b4d682e1186005861f18e9eb7e45)
    +
    +    Conflicts:
    +            src/rgw/rgw_asio_frontend.cc
    +     - `sal_ctx` capture on main does not exist in tentacle
    +
    +    Fixes: https://tracker.ceph.com/issues/78122
    +    Signed-off-by: Adam C. Emerson <[email protected]>
     
      ## src/rgw/rgw_asio_frontend.cc ##
     @@ src/rgw/rgw_asio_frontend.cc: void AsioFrontend::on_accept(Listener& l, tcp::socket stream)
    - #endif
    +   if (l.use_ssl) {
          boost::asio::spawn(make_strand(context), std::allocator_arg, make_stack_allocator(),
    -       [this, s=std::move(stream), ssl_ctx] (boost::asio::yield_context yield) mutable {
    +       [this, s=std::move(stream)] (boost::asio::yield_context yield) mutable {
     -        auto conn = boost::intrusive_ptr{new Connection(std::move(s))};
     +        auto conn = boost::intrusive_ptr{new Connection(std::move(s), yield.get_executor())};
              auto c = connections.add(*conn);
              // wrap the tcp stream in an ssl stream
    -         boost::asio::ssl::stream<tcp::socket&> stream{conn->socket, *ssl_ctx};
    +         boost::asio::ssl::stream<tcp::socket&> stream{conn->socket, *ssl_context};
     @@ src/rgw/rgw_asio_frontend.cc: void AsioFrontend::on_accept(Listener& l, tcp::socket stream)
      #endif // WITH_RADOSGW_BEAST_OPENSSL
          boost::asio::spawn(make_strand(context), std::allocator_arg, make_stack_allocator(),

How to proceed:

  • Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git Conflicts: block intact) and include an explanation for changes.
  • Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
  • Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting /audit override.

Be familiar with the rules and guidelines for writing backports.


🛟 Need Help?

If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.

📋 Component Lead / Release Manager

To override the audit failure, apply releng-audit-override label or comment /audit override.


⚠️ Note: Automated audit checks will be suspended on future pushes to prevent comment spam while you work.

When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.

View workflow run

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Jul 16, 2026
@adamemerson

Copy link
Copy Markdown
Contributor Author

/audit override

@github-actions github-actions Bot added releng-audit-override and removed releng-audit-fail Release engineering: failed backport verification audit. labels Jul 16, 2026
@github-actions

Copy link
Copy Markdown

✅ Audit Override Applied by @adamemerson.

View workflow run

@mheler
mheler self-requested a review July 16, 2026 22:50
@anrao19

anrao19 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@adamemerson

Copy link
Copy Markdown
Contributor Author

jenkins test windows

2 similar comments
@adamemerson

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@adamemerson

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@batrick
batrick merged commit 44bcd05 into ceph:tentacle Jul 22, 2026
7 of 8 checks passed
@batrick

batrick commented Jul 22, 2026

Copy link
Copy Markdown
Member

@BBoozmen @mheler please add yourselves to .githubmap in the main branch.

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.

7 participants