]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: correctly set worker thread names 63095/head
authorMilind Changire <mchangir@redhat.com>
Fri, 2 May 2025 03:25:17 +0000 (08:55 +0530)
committerMilind Changire <mchangir@redhat.com>
Sat, 7 Jun 2025 18:10:23 +0000 (23:40 +0530)
Introduced-by: e53c2311fdebdfb830b771c608ecb0c10ebf886e
Fixes: https://tracker.ceph.com/issues/71156
Signed-off-by: Milind Changire <mchangir@redhat.com>
src/rgw/driver/rados/rgw_notify.cc

index eacabcc39891eaf3cfb78cff23ba04e35a6a4610..0669aa8e5e1b7d1a48598a07dac1cbb927b453f6 100644 (file)
@@ -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;
     }