]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: fixes to print exceptions and errors
authorYingxin Cheng <yingxin.cheng@intel.com>
Tue, 13 Dec 2022 08:39:05 +0000 (16:39 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 8 Feb 2023 06:07:41 +0000 (14:07 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/ProtocolV2.cc
src/crimson/net/io_handler.cc

index 0b9d4be2d257d33fce3d419e18b9820440449d82..77973b652a50cc602e1f4cb7007df696f5809fe0 100644 (file)
@@ -1527,9 +1527,15 @@ void ProtocolV2::execute_accepting()
            default:
             ceph_abort("impossible next step");
           }
-        }).handle_exception([this] (std::exception_ptr eptr) {
+        }).handle_exception([this](std::exception_ptr eptr) {
+          const char *e_what;
+          try {
+            std::rethrow_exception(eptr);
+          } catch (std::exception &e) {
+            e_what = e.what();
+          }
           logger().info("{} execute_accepting(): fault at {}, going to CLOSING -- {}",
-                        conn, get_state_name(state), eptr);
+                        conn, get_state_name(state), e_what);
           do_close(false);
         });
     });
@@ -1834,9 +1840,15 @@ void ProtocolV2::execute_wait(bool max_backoff)
       }
       logger().info("{} execute_wait(): going to CONNECTING", conn);
       execute_connecting();
-    }).handle_exception([this] (std::exception_ptr eptr) {
+    }).handle_exception([this](std::exception_ptr eptr) {
+      const char *e_what;
+      try {
+        std::rethrow_exception(eptr);
+      } catch (std::exception &e) {
+        e_what = e.what();
+      }
       logger().info("{} execute_wait(): protocol aborted at {} -- {}",
-                    conn, get_state_name(state), eptr);
+                    conn, get_state_name(state), e_what);
       assert(state == state_t::REPLACING ||
              state == state_t::CLOSING);
     });
@@ -1854,9 +1866,15 @@ void ProtocolV2::execute_server_wait()
     ).then([this](auto bl) {
       logger().warn("{} SERVER_WAIT got read, abort", conn);
       abort_in_fault();
-    }).handle_exception([this] (std::exception_ptr eptr) {
+    }).handle_exception([this](std::exception_ptr eptr) {
+      const char *e_what;
+      try {
+        std::rethrow_exception(eptr);
+      } catch (std::exception &e) {
+        e_what = e.what();
+      }
       logger().info("{} execute_server_wait(): fault at {}, going to CLOSING -- {}",
-                    conn, get_state_name(state), eptr);
+                    conn, get_state_name(state), e_what);
       do_close(false);
     });
   });
index 20bcdbde88f529c22bce32c2e151a08ab37a9195..d0d532ed4dbcacd82fd0d0481e274ce08e4cacea 100644 (file)
@@ -450,13 +450,13 @@ seastar::future<> IOHandler::do_out_dispatch()
         e.code() != std::errc::connection_reset &&
         e.code() != error::negotiation_failure) {
       logger().error("{} do_out_dispatch(): unexpected error at {} -- {}",
-                     conn, io_state, e);
+                     conn, io_state, e.what());
       ceph_abort();
     }
 
     if (io_state == io_state_t::open) {
       logger().info("{} do_out_dispatch(): fault at {}, going to delay -- {}",
-                    conn, io_state, e);
+                    conn, io_state, e.what());
       std::exception_ptr eptr;
       try {
         throw e;
@@ -467,7 +467,7 @@ seastar::future<> IOHandler::do_out_dispatch()
       handshake_listener->notify_out_fault("do_out_dispatch", eptr);
     } else {
       logger().info("{} do_out_dispatch(): fault at {} -- {}",
-                    conn, io_state, e);
+                    conn, io_state, e.what());
     }
 
     return do_out_dispatch();