From: Yingxin Cheng Date: Tue, 13 Dec 2022 08:39:05 +0000 (+0800) Subject: crimson/net: fixes to print exceptions and errors X-Git-Tag: v18.1.0~375^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f99ebd9f14a6d3caebab9f1c5cbbca5b18c5a5d2;p=ceph-ci.git crimson/net: fixes to print exceptions and errors Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 0b9d4be2d25..77973b652a5 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -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); }); }); diff --git a/src/crimson/net/io_handler.cc b/src/crimson/net/io_handler.cc index 20bcdbde88f..d0d532ed4db 100644 --- a/src/crimson/net/io_handler.cc +++ b/src/crimson/net/io_handler.cc @@ -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();