From: SrinivasaBharathKanta <61141011+SrinivasaBharath@users.noreply.github.com> Date: Fri, 27 Sep 2024 21:44:45 +0000 (+0530) Subject: Merge pull request #57659 from mkogan1/wip-graceful-shutdown X-Git-Tag: v20.0.0~948 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=90ded57c8815b2b3334473c61d1978377922cc1a;p=ceph.git Merge pull request #57659 from mkogan1/wip-graceful-shutdown rgw: delay the RGW process exit until all actice requests have completed --- 90ded57c8815b2b3334473c61d1978377922cc1a diff --cc src/rgw/rgw_asio_frontend.cc index f80e40c70b621,855b9650f0ca5..30e1e77fd151e --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@@ -1153,9 -1085,21 +1153,23 @@@ void AsioFrontend::stop( // close all listeners for (auto& listener : listeners) { listener.acceptor.close(ec); + // signal cancellation of accept() + listener.signal.emit(boost::asio::cancellation_type::terminal); } + + const bool graceful_stop{ g_ceph_context->_conf->rgw_graceful_stop }; + if (graceful_stop) { + ldout(ctx(), 4) << "frontend pausing and waiting for outstanding requests to complete..." << dendl; + pause_mutex.lock(ec); + if (ec) { + ldout(ctx(), 1) << "frontend failed to pause: " << ec.message() << dendl; + } else { + ldout(ctx(), 4) << "frontend paused" << dendl; + } + ldout(ctx(), 4) << "frontend outstanding requests have completed" << dendl; + pause_mutex.unlock(); + } + // close all connections connections.close(ec); pause_mutex.cancel();