From: Milind Changire Date: Fri, 2 May 2025 03:25:17 +0000 (+0530) Subject: rgw: correctly set worker thread names X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F63095%2Fhead;p=ceph.git rgw: correctly set worker thread names Introduced-by: e53c2311fdebdfb830b771c608ecb0c10ebf886e Fixes: https://tracker.ceph.com/issues/71156 Signed-off-by: Milind Changire --- diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index eacabcc39891e..0669aa8e5e1b7 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; }