From 86ca4ba39081abeba25d68777b244ff1142a7d3d Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Fri, 2 May 2025 08:55:17 +0530 Subject: [PATCH] rgw: correctly set worker thread names Introduced-by: e53c2311fdebdfb830b771c608ecb0c10ebf886e Fixes: https://tracker.ceph.com/issues/71156 Signed-off-by: Milind Changire --- src/rgw/driver/rados/rgw_notify.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index eacabcc39891..0669aa8e5e1b 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -472,7 +472,14 @@ 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]() { + const std::string thread_name = WORKER_THREAD_NAME+std::to_string(worker_id); + workers.emplace_back([this, thread_name]() { + // set the current thread name + if (const auto rc = ceph_pthread_setname(thread_name.c_str()); rc != 0) { + ldpp_dout(this, 1) << "ERROR: failed to set notification manager " + << "thread name to: " << thread_name + << ". error: " << rc << dendl; + } try { io_context.run(); } catch (const std::exception& err) { @@ -480,11 +487,6 @@ public: throw(err); } }); - const std::string thread_name = WORKER_THREAD_NAME+std::to_string(worker_id); - if (const auto rc = ceph_pthread_setname(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) << "Started notification manager with: " << worker_count << " workers" << dendl; } -- 2.47.3