From: chunmei Liu Date: Thu, 12 Sep 2019 21:01:37 +0000 (-0700) Subject: crimson/mon:use shared_future for waiting MauthReply X-Git-Tag: v15.1.0~1551^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F30366%2Fhead;p=ceph.git crimson/mon:use shared_future for waiting MauthReply when monitor-side close the connection, msgr call MonClient ms_handle_reset cause reply.get_future be called twice then assert happen in promise.get_future. promise::get_future() noexcept { assert(!this->_future && this->_state && !this->_task); return future(this); } use shared_promise instead of promise to solve it. Signed-off-by: chunmei Liu --- diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 2c236af718bd..10d12cb0aef0 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -4,6 +4,7 @@ #include #include +#include #include #include "auth/AuthClientHandler.h" @@ -107,7 +108,7 @@ private: private: bool closed = false; // v1 - seastar::promise> reply; + seastar::shared_promise> reply; // v2 using clock_t = seastar::lowres_system_clock; clock_t::time_point auth_start; @@ -251,7 +252,7 @@ Connection::do_auth_single(Connection::request_t what) logger().info("sending {}", *m); return conn->send(m).then([this] { logger().info("waiting"); - return reply.get_future(); + return reply.get_shared_future(); }).then([this] (Ref m) { if (!m) { ceph_assert(closed); @@ -297,7 +298,7 @@ Connection::authenticate_v1(epoch_t epoch, return conn->keepalive().then([epoch, name, this] { return setup_session(epoch, name); }).then([this] { - return reply.get_future(); + return reply.get_shared_future(); }).then([name, want_keys, this](Ref m) { if (!m) { logger().error("authenticate_v1 canceled on {}", name);