From: Yingxin Date: Fri, 14 Sep 2018 10:21:07 +0000 (+0800) Subject: crimson/net: Fix racing for promise on_message X-Git-Tag: v14.0.1~293^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F24097%2Fhead;p=ceph.git crimson/net: Fix racing for promise on_message read_tags_until_next_message() will forward the ready future and create a new promise for on_message, which assumes there is already a read_message() holding the previous promise, but it is not true. Signed-off-by: Yingxin --- diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 3a9cb1f58345..2ad467b55d0b 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -161,7 +161,6 @@ void SocketConnection::read_tags_until_next_message() }).then_wrapped([this] (auto fut) { // satisfy the message promise fut.forward_to(std::move(on_message)); - on_message = seastar::promise<>{}; }); } @@ -209,6 +208,7 @@ seastar::future SocketConnection::read_message() { return on_message.get_future() .then([this] { + on_message = seastar::promise<>{}; // read header return read(sizeof(m.header)); }).then([this] (bufferlist bl) {