From 449550b0efc2ff77e15662d3ad304006c9498ea7 Mon Sep 17 00:00:00 2001 From: chunmei Liu Date: Thu, 12 Sep 2019 14:01:37 -0700 Subject: [PATCH] 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 --- src/crimson/mon/MonClient.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 2c236af718bd2..10d12cb0aef06 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); -- 2.39.5