Skip to content

rgw/beast: fix shutdown crash from concurrent socket close in ConnectionList::close() - #69713

Merged
BBoozmen merged 4 commits into
ceph:mainfrom
BBoozmen:wip-oozmen-77658
Jul 1, 2026
Merged

BBoozmen merged 4 commits into
ceph:mainfrom
BBoozmen:wip-oozmen-77658

Conversation

@BBoozmen

Copy link
Copy Markdown
Contributor

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

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.

@BBoozmen BBoozmen self-assigned this Jun 24, 2026
@BBoozmen
BBoozmen requested a review from a team as a code owner June 24, 2026 16:12
@BBoozmen BBoozmen changed the title Wip oozmen 77658 rgw/beast: fix shutdown crash from concurrent socket close in ConnectionList::close() Jun 24, 2026
Comment thread src/rgw/rgw_asio_frontend_connection.h Resolved
Comment thread src/rgw/rgw_asio_frontend.cc Resolved
BBoozmen added 4 commits June 24, 2026 19:01
… 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]>
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]>
This is meant to be used in unittesting.

Signed-off-by: Oguzhan Ozmen <[email protected]>
@BBoozmen BBoozmen added needs-qa wip-oozmen-testing for teuthology integration testing to be used via build-integration-branch.sh and removed wip-oozmen-testing for teuthology integration testing to be used via build-integration-branch.sh labels Jun 24, 2026
@BBoozmen BBoozmen mentioned this pull request Jun 27, 2026
4 of 14 tasks
@BBoozmen

Copy link
Copy Markdown
Contributor Author

Test branch: https://github.com/ceph/ceph-ci/commits/wip-oozmen-testing-connList-2026-06-24-1909/
QA Test Results: https://pulpito.ceph.com/bcs-ceph-2026-06-25_20:18:22-rgw-wip-oozmen-testing-connList-2026-06-24-1909-distro-default-trial/
Summary: 75 PASSED / 4 FAILED

Suite Variant Job ID OS Failing Testscases RootCause
1 rgw/multisite two-zones 317240 ubuntu 22.04 test_copy_object_same_bucket (1 of 57 failed) Known flaky Bug#75715
2 rgw/multisite two-zonegroup 317201 ubuntu 24.04 test_bucket_sync_disable, test_bucket_log_trim_after_delete_bucket_secondary_reshard, test_copy_object_different_bucket (3 of 57 failed) Known flaky Bug#72948, Bug#70858, Bug#75716
3 rgw/s3control http 317203 ubuntu 22.04 ObjectLock teardown cascade: 304 ERRORs, 0 actual FAILEDs. Root cause: DNS resolution failure (NameResolutionError: s3.trial058) during teardown after test_copy_enc[sse-kms-...-FROZEN-*] tests. RGW endpoint became unreachable. Infra — DNS/connection issue
4 rgw/d4n — 317195 centos 9.stream RGW crash at startup: filesystem error: cannot get free space: No such file or directory [/tmp/rgw_d4n_datacache/] => Caught signal (Aborted) Known infra — d4n datacache dir missing

@BBoozmen BBoozmen added TESTED and removed wip-oozmen-testing for teuthology integration testing to be used via build-integration-branch.sh needs-qa labels Jun 29, 2026
@BBoozmen
BBoozmen merged commit 66b1546 into ceph:main Jul 1, 2026
6 checks passed
@github-actions

github-actions Bot commented Jul 1, 2026

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/28539154224

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