diff --git a/src/common/Thread.cc b/src/common/Thread.cc index aaee01aeff3..50c4e252efc 100644 --- a/src/common/Thread.cc +++ b/src/common/Thread.cc @@ -70,7 +70,7 @@ Thread::~Thread() { } -void *Thread::_entry_func(void *arg) { +void *Thread::_entry_func(void *arg) noexcept { void *r = ((Thread*)arg)->entry_wrapper(); return r; } diff --git a/src/common/Thread.h b/src/common/Thread.h index 5242fb5f307..396e167a884 100644 --- a/src/common/Thread.h +++ b/src/common/Thread.h @@ -48,7 +48,7 @@ class Thread { virtual void *entry() = 0; private: - static void *_entry_func(void *arg); + static void *_entry_func(void *arg) noexcept; public: const pthread_t &get_thread_id() const; diff --git a/src/rgw/rgw_amqp.cc b/src/rgw/rgw_amqp.cc index ff30a7841d5..cce5b8612be 100644 --- a/src/rgw/rgw_amqp.cc +++ b/src/rgw/rgw_amqp.cc @@ -628,7 +628,7 @@ private: // (3) manages deleted connections // (4) TODO reconnect on connection errors // (5) TODO cleanup timedout callbacks - void run() { + void run() noexcept { amqp_frame_t frame; while (!stopped) { diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index e5334844f63..7bafaf9e875 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -953,11 +953,12 @@ int AsioFrontend::run() work.emplace(boost::asio::make_work_guard(context)); for (int i = 0; i < thread_count; i++) { - threads.emplace_back([=] { + threads.emplace_back([=]() noexcept { // request warnings on synchronous librados calls in this thread is_asio_thread = true; - boost::system::error_code ec; - context.run(ec); + // Have uncaught exceptions kill the process and give a + // stacktrace, not be swallowed. + context.run(); }); } return 0; diff --git a/src/rgw/rgw_datalog.cc b/src/rgw/rgw_datalog.cc index a875d075eca..5df33783199 100644 --- a/src/rgw/rgw_datalog.cc +++ b/src/rgw/rgw_datalog.cc @@ -864,7 +864,7 @@ RGWDataChangesLog::~RGWDataChangesLog() { } } -void RGWDataChangesLog::renew_run() { +void RGWDataChangesLog::renew_run() noexcept { for (;;) { dout(2) << "RGWDataChangesLog::ChangesRenewThread: start" << dendl; int r = renew_entries(); diff --git a/src/rgw/rgw_datalog.h b/src/rgw/rgw_datalog.h index 5440b3d1e4b..1e8652409ed 100644 --- a/src/rgw/rgw_datalog.h +++ b/src/rgw/rgw_datalog.h @@ -201,7 +201,7 @@ class RGWDataChangesLog { ceph::mutex renew_lock = ceph::make_mutex("ChangesRenewThread::lock"); ceph::condition_variable renew_cond; - void renew_run(); + void renew_run() noexcept; void renew_stop(); std::thread renew_thread; diff --git a/src/rgw/rgw_kafka.cc b/src/rgw/rgw_kafka.cc index 1e8af36ba87..55960971144 100644 --- a/src/rgw/rgw_kafka.cc +++ b/src/rgw/rgw_kafka.cc @@ -396,7 +396,7 @@ private: // (3) manages deleted connections // (4) TODO reconnect on connection errors // (5) TODO cleanup timedout callbacks - void run() { + void run() noexcept { while (!stopped) { // publish all messages in the queue diff --git a/src/rgw/rgw_notify.cc b/src/rgw/rgw_notify.cc index 29b0c44093a..b2e114623bf 100644 --- a/src/rgw/rgw_notify.cc +++ b/src/rgw/rgw_notify.cc @@ -483,7 +483,7 @@ public: // start the worker threads to do the actual queue processing const std::string WORKER_THREAD_NAME = "notif-worker"; for (auto worker_id = 0U; worker_id < worker_count; ++worker_id) { - workers.emplace_back([this]() { io_context.run(); }); + workers.emplace_back([this]() noexcept { io_context.run(); }); const auto rc = ceph_pthread_setname(workers.back().native_handle(), (WORKER_THREAD_NAME+std::to_string(worker_id)).c_str()); ceph_assert(rc == 0); diff --git a/src/rgw/rgw_period_pusher.cc b/src/rgw/rgw_period_pusher.cc index 0eb394ed9c7..66511bbcaed 100644 --- a/src/rgw/rgw_period_pusher.cc +++ b/src/rgw/rgw_period_pusher.cc @@ -145,7 +145,7 @@ class RGWPeriodPusher::CRThread { { http.start(); // must spawn the CR thread after start - thread = std::thread([this] { coroutines.run(push_all.get()); }); + thread = std::thread([this]() noexcept { coroutines.run(push_all.get()); }); } ~CRThread() {