Repository navigation
tentacle: rgw: Fix crashes on realm reload - #70262
Conversation
|
/audit override |
|
✅ Audit Override Applied by @adamemerson. |
… 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]>
Tests: https://tracker.ceph.com/issues/77658 Signed-off-by: Oguzhan Ozmen <[email protected]> (cherry picked from commit 19748f1) 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]>
To prevent a race condition/crash on realm reload where sync was trying to put objects through quota before quota was initialized. Fixes: https://tracker.ceph.com/issues/76094 Fixes: https://tracker.ceph.com/issues/77883 Signed-off-by: Adam C. Emerson <[email protected]> (cherry picked from commit e8639cc) 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]>
fbeb8e1 to
f411a82
Compare
|
New commits were pushed to this PR, so the previous override has been removed. |
There was a problem hiding this comment.
Ceph Release Engineering Audit Report
Automated Backport Parity Review
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
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)
src/rgw/rgw_asio_frontend.cc
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.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
|
/audit override |
|
✅ Audit Override Applied by @adamemerson. |
|
This PR has been added to tentacle integration testing by anuchaithra started 2026-07-17-06:32. |
|
jenkins test windows |
2 similar comments
|
jenkins test windows |
|
jenkins test windows |
Original trackers: https://tracker.ceph.com/issues/76094 https://tracker.ceph.com/issues/77658
Backport trackers: https://tracker.ceph.com/issues/78122 https://tracker.ceph.com/issues/78307
Original PRs: #68920 #69713
3a09906 is intentionally not included. It was a change to a cleanup (#66721) that does not need to be backported.