]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: throw a system error when center.init fails
authorXiubo Li <xiubli@redhat.com>
Fri, 7 Aug 2020 07:45:52 +0000 (15:45 +0800)
committerXiubo Li <xiubli@redhat.com>
Sun, 9 Aug 2020 08:09:37 +0000 (16:09 +0800)
In the libcephfs test case, it will run handreds of threads in
parallel, it will possibly reach the open files limit, but there
won't useful logs about what has happened.

This will just throw a system error, just like:

C++ exception with description "(24) Too many open files" thrown in the test body.

Fixes: https://tracker.ceph.com/issues/43039
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/msg/async/Stack.cc

index 74d07829be9a4a83e0113b9dd88396bc58f3c62a..6885fd4f9dbcfdeaf71131631a1168eb29a0f811 100644 (file)
@@ -118,7 +118,9 @@ NetworkStack::NetworkStack(CephContext *c, const std:: string &t): type(t), star
 
   for (unsigned worker_id = 0; worker_id < num_workers; ++worker_id) {
     Worker *w = create_worker(cct, type, worker_id);
-    w->center.init(InitEventNumber, worker_id, type);
+    int ret = w->center.init(InitEventNumber, worker_id, type);
+    if (ret)
+      throw std::system_error(-ret, std::generic_category());
     workers.push_back(w);
   }
 }