]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/async: drop noexcept on io_context_pool threadfunc
authorIlya Dryomov <idryomov@gmail.com>
Wed, 4 Aug 2021 12:58:11 +0000 (14:58 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Sat, 7 Aug 2021 12:18:29 +0000 (14:18 +0200)
This issue has been addressed in g++ 8: there is no try/catch in
execute_native_thread_routine() anymore [1][2] and noexcept ends up
having the opposite effect.  Whereas without noexcept g++ guarantees
that the stack would not be unwound [3], it doesn't make such guarantee
for the noexcept case.  According to the standard, these cases are
distinct and even though both are implementation defined, g++ only
defines the former.  With noexcept, it unwinds up to the noexcept frame
which is not useful at all.  (clang unwinds up to and including the
noexcept frame and only msvc does the right thing and immediately
terminates.)

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=754d67d5ba4a1f9994210d402893a4cf49ce6a71
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55917
[3] https://gcc.gnu.org/onlinedocs/gcc/Exception-handling.html

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/common/async/context_pool.h

index 992b3eccb0a35c9b33857610741fa30a92881ddb..9c6cab7677db4504efd8ec3292da172336009ea2 100644 (file)
@@ -58,13 +58,8 @@ public:
       guard.emplace(boost::asio::make_work_guard(ioctx));
       ioctx.restart();
       for (std::int16_t i = 0; i < threadcnt; ++i) {
-       // Mark this function as noexcept so any uncaught exceptions
-       // call terminate at point of throw. Otherwise, under
-       // libstdc++, they get caught by the thread cancellation
-       // infrastructure, unwinding the stack and making debugging
-       // much more difficult.
        threadvec.emplace_back(make_named_thread("io_context_pool",
-                                                [this]() noexcept {
+                                                [this]() {
                                                   ioctx.run();
                                                 }));
       }