From 7e679576a8082e7a83db4ceb2120950fe445aa4a Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Tue, 11 Jun 2024 15:12:01 +0000 Subject: [PATCH] rgw: do not assert on thread name setting failures Fixes: https://tracker.ceph.com/issues/64305 Signed-off-by: Yuval Lifshitz --- src/rgw/driver/rados/rgw_notify.cc | 8 +++++--- src/rgw/rgw_amqp.cc | 7 +++++-- src/rgw/rgw_kafka.cc | 7 +++++-- src/rgw/rgw_lua_background.cc | 8 +++++--- src/rgw/rgw_ratelimit.h | 5 +++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index dd94d3155f8ca..bb0bb40e64bd3 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -767,9 +767,11 @@ public: throw err; } }); - const auto rc = ceph_pthread_setname(workers.back().native_handle(), - (WORKER_THREAD_NAME+std::to_string(worker_id)).c_str()); - ceph_assert(rc == 0); + const auto thread_name = WORKER_THREAD_NAME+std::to_string(worker_id); + if (const auto rc = ceph_pthread_setname(workers.back().native_handle(), thread_name.c_str()); rc != 0) { + ldpp_dout(this, 1) << "ERROR: failed to set notification manager thread name to: " << thread_name + << ". error: " << rc << dendl; + } } ldpp_dout(this, 10) << "INfO: started notification manager with: " << worker_count << " workers" << dendl; } diff --git a/src/rgw/rgw_amqp.cc b/src/rgw/rgw_amqp.cc index ea824b8295aca..e676b7b044bc5 100644 --- a/src/rgw/rgw_amqp.cc +++ b/src/rgw/rgw_amqp.cc @@ -836,8 +836,11 @@ public: // when a new connection is added. connections.max_load_factor(10.0); // give the runner thread a name for easier debugging - const auto rc = ceph_pthread_setname(runner.native_handle(), "amqp_manager"); - ceph_assert(rc==0); + const char* thread_name = "amqp_manager"; + if (const auto rc = ceph_pthread_setname(runner.native_handle(), thread_name); rc != 0) { + ldout(cct, 1) << "ERROR: failed to set amqp manager thread name to: " << thread_name + << ". error: " << rc << dendl; + } } // non copyable diff --git a/src/rgw/rgw_kafka.cc b/src/rgw/rgw_kafka.cc index 9a356d9c6f04e..e54cd037a7f3a 100644 --- a/src/rgw/rgw_kafka.cc +++ b/src/rgw/rgw_kafka.cc @@ -527,8 +527,11 @@ public: // when a new connection is added. connections.max_load_factor(10.0); // give the runner thread a name for easier debugging - const auto rc = ceph_pthread_setname(runner.native_handle(), "kafka_manager"); - ceph_assert(rc==0); + const char* thread_name = "kafka_manager"; + if (const auto rc = ceph_pthread_setname(runner.native_handle(), thread_name); rc != 0) { + ldout(cct, 1) << "ERROR: failed to set kafka manager thread name to: " << thread_name + << ". error: " << rc << dendl; + } } // non copyable diff --git a/src/rgw/rgw_lua_background.cc b/src/rgw/rgw_lua_background.cc index 93c509a78cc78..ef97a5d6f65ea 100644 --- a/src/rgw/rgw_lua_background.cc +++ b/src/rgw/rgw_lua_background.cc @@ -83,9 +83,11 @@ void Background::start() { } started = true; runner = std::thread(&Background::run, this); - const auto rc = ceph_pthread_setname(runner.native_handle(), - "lua_background"); - ceph_assert(rc == 0); + const char* thread_name = "lua_background"; + if (const auto rc = ceph_pthread_setname(runner.native_handle(), thread_name); rc != 0) { + ldout(cct, 1) << "ERROR: failed to set lua background thread name to: " << thread_name + << ". error: " << rc << dendl; + } } void Background::pause() { diff --git a/src/rgw/rgw_ratelimit.h b/src/rgw/rgw_ratelimit.h index 2639d4d42749f..0db1813f05002 100644 --- a/src/rgw/rgw_ratelimit.h +++ b/src/rgw/rgw_ratelimit.h @@ -286,7 +286,8 @@ class ActiveRateLimiter : public DoutPrefix { void start() { ldpp_dout(this, 20) << "starting ratelimit_gc thread" << dendl; runner = std::thread(&ActiveRateLimiter::replace_active, this); - const auto rc = ceph_pthread_setname(runner.native_handle(), "ratelimit_gc"); - ceph_assert(rc==0); + if (const auto rc = ceph_pthread_setname(runner.native_handle(), "ratelimit_gc"); rc != 0) { + ldpp_dout(this, 1) << "ERROR: failed to set ratelimit_gc thread name. error: " << rc << dendl; + } } }; -- 2.39.5