From: luo rixin Date: Sat, 22 Feb 2020 09:57:46 +0000 (+0800) Subject: test/test_socket: fix dispatch_sockets() unexpected exception X-Git-Tag: v15.1.1~135^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33482%2Fhead;p=ceph.git test/test_socket: fix dispatch_sockets() unexpected exception In the test test_unexpected_down(), there is client running on CPU0 and server runing on CPU1, the server maybe finished before the client (client and other workloads share CPU0), so client couldn't read data and throws "dispatch_sockets(): cb_client() got unexpected exception std::system_error (error crimson::net:4, read eof)" Signed-off-by: luo rixin --- diff --git a/src/test/crimson/test_socket.cc b/src/test/crimson/test_socket.cc index cb44373f8de5..5d1458ba4a2e 100644 --- a/src/test/crimson/test_socket.cc +++ b/src/test/crimson/test_socket.cc @@ -373,7 +373,13 @@ future<> test_read_write() { future<> test_unexpected_down() { logger.info("test_unexpected_down()..."); return SocketFactory::dispatch_sockets( - [] (auto cs) { return Connection::dispatch_rw_bounded(cs, 128, true); }, + [] (auto cs) { + return Connection::dispatch_rw_bounded(cs, 128, true + ).handle_exception_type([] (const std::system_error& e) { + logger.debug("test_unexpected_down(): client get error {}", e); + ceph_assert(e.code() == error::read_eof); + }); + }, [] (auto ss) { return Connection::dispatch_rw_unbounded(ss); } ).then([] { logger.info("test_unexpected_down() ok\n");