Skip to content

Commit 7e67957

Browse files
committed
rgw: do not assert on thread name setting failures
Fixes: https://tracker.ceph.com/issues/64305 Signed-off-by: Yuval Lifshitz <[email protected]>
1 parent ac14488 commit 7e67957

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

src/rgw/driver/rados/rgw_notify.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,11 @@ class Manager : public DoutPrefixProvider {
767767
throw err;
768768
}
769769
});
770-
const auto rc = ceph_pthread_setname(workers.back().native_handle(),
771-
(WORKER_THREAD_NAME+std::to_string(worker_id)).c_str());
772-
ceph_assert(rc == 0);
770+
const auto thread_name = WORKER_THREAD_NAME+std::to_string(worker_id);
771+
if (const auto rc = ceph_pthread_setname(workers.back().native_handle(), thread_name.c_str()); rc != 0) {
772+
ldpp_dout(this, 1) << "ERROR: failed to set notification manager thread name to: " << thread_name
773+
<< ". error: " << rc << dendl;
774+
}
773775
}
774776
ldpp_dout(this, 10) << "INfO: started notification manager with: " << worker_count << " workers" << dendl;
775777
}

src/rgw/rgw_amqp.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,11 @@ class Manager {
836836
// when a new connection is added.
837837
connections.max_load_factor(10.0);
838838
// give the runner thread a name for easier debugging
839-
const auto rc = ceph_pthread_setname(runner.native_handle(), "amqp_manager");
840-
ceph_assert(rc==0);
839+
const char* thread_name = "amqp_manager";
840+
if (const auto rc = ceph_pthread_setname(runner.native_handle(), thread_name); rc != 0) {
841+
ldout(cct, 1) << "ERROR: failed to set amqp manager thread name to: " << thread_name
842+
<< ". error: " << rc << dendl;
843+
}
841844
}
842845

843846
// non copyable

src/rgw/rgw_kafka.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,11 @@ class Manager {
527527
// when a new connection is added.
528528
connections.max_load_factor(10.0);
529529
// give the runner thread a name for easier debugging
530-
const auto rc = ceph_pthread_setname(runner.native_handle(), "kafka_manager");
531-
ceph_assert(rc==0);
530+
const char* thread_name = "kafka_manager";
531+
if (const auto rc = ceph_pthread_setname(runner.native_handle(), thread_name); rc != 0) {
532+
ldout(cct, 1) << "ERROR: failed to set kafka manager thread name to: " << thread_name
533+
<< ". error: " << rc << dendl;
534+
}
532535
}
533536

534537
// non copyable

src/rgw/rgw_lua_background.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ void Background::start() {
8383
}
8484
started = true;
8585
runner = std::thread(&Background::run, this);
86-
const auto rc = ceph_pthread_setname(runner.native_handle(),
87-
"lua_background");
88-
ceph_assert(rc == 0);
86+
const char* thread_name = "lua_background";
87+
if (const auto rc = ceph_pthread_setname(runner.native_handle(), thread_name); rc != 0) {
88+
ldout(cct, 1) << "ERROR: failed to set lua background thread name to: " << thread_name
89+
<< ". error: " << rc << dendl;
90+
}
8991
}
9092

9193
void Background::pause() {

src/rgw/rgw_ratelimit.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ class ActiveRateLimiter : public DoutPrefix {
286286
void start() {
287287
ldpp_dout(this, 20) << "starting ratelimit_gc thread" << dendl;
288288
runner = std::thread(&ActiveRateLimiter::replace_active, this);
289-
const auto rc = ceph_pthread_setname(runner.native_handle(), "ratelimit_gc");
290-
ceph_assert(rc==0);
289+
if (const auto rc = ceph_pthread_setname(runner.native_handle(), "ratelimit_gc"); rc != 0) {
290+
ldpp_dout(this, 1) << "ERROR: failed to set ratelimit_gc thread name. error: " << rc << dendl;
291+
}
291292
}
292293
};

0 commit comments

Comments
 (0)