From df2d768dd7d0db320017c72a15b56aa25f738592 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Fri, 7 Aug 2020 15:45:52 +0800 Subject: [PATCH] msg: throw a system error when center.init fails 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 (cherry picked from commit 6338050) Conflicts: src/msg/async/Stack.cc - nautilus uses plain "i" as the for loop counter variable, while master has more fancy "worker_id" --- src/msg/async/Stack.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/msg/async/Stack.cc b/src/msg/async/Stack.cc index 8976c3cc43a85..db3247ed1a84c 100644 --- a/src/msg/async/Stack.cc +++ b/src/msg/async/Stack.cc @@ -117,7 +117,9 @@ NetworkStack::NetworkStack(CephContext *c, const string &t): type(t), started(fa for (unsigned i = 0; i < num_workers; ++i) { Worker *w = create_worker(cct, type, i); - w->center.init(InitEventNumber, i, type); + int ret = w->center.init(InitEventNumber, i, type); + if (ret) + throw std::system_error(-ret, std::generic_category()); workers.push_back(w); } } -- 2.39.5