]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw/beast: use strand executor for timeout timer to prevent concurrent socket access 68506/head
authorOguzhan Ozmen <oozmen@bloomberg.net>
Thu, 19 Feb 2026 01:42:54 +0000 (01:42 +0000)
committerOguzhan Ozmen <oozmen@bloomberg.net>
Tue, 21 Apr 2026 13:42:37 +0000 (13:42 +0000)
commit6f42d49709f8d1802b0835ea59bf68d5f072526a
tree60eb84325c2095428de943efa6c0009f758abbbc
parent51864afe208138783312f7ed2b1c1373216adaca
rgw/beast: use strand executor for timeout timer to prevent concurrent socket access

The timeout_timer in AsioFrontend::on_accept() was constructed with
context.get_executor(), which dispatches the timeout handler to the
raw io_context. Since each connection's coroutine runs on a strand
(via make_strand(context)), this allowed the timeout handler to
execute concurrently with the coroutine on a different thread.

When the timeout fires, timeout_handler calls socket.cancel() and
socket.shutdown() racing with the coroutine's async_read_header(),
async_write(), or async_read_some() on the same socket and buffer.
This can corrupt the flat_static_buffer's internal pointers, leading
to SIGSEGV in the Beast HTTP parser.

Fix by constructing the timeout_timer with yield.get_executor(),
which returns the coroutine's strand executor. This ensures the
timeout handler is serialized with the coroutine, preventing
concurrent access to the socket and buffer.

Fixes: https://tracker.ceph.com/issues/75031
Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
(cherry picked from commit 86ad0b891b040ab4c2e80e0d0577e9b1d080679a)

Conflicts:
   src/rgw/rgw_asio_frontend.cc
- argument renaming: ssl_context is renamed as ssl_ctx in main
src/rgw/rgw_asio_frontend.cc