From 6365e02926371b7cd32deae631bf3e18b90b2e41 Mon Sep 17 00:00:00 2001 From: Yingxin Date: Fri, 14 Sep 2018 18:21:07 +0800 Subject: [PATCH] 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 --- src/crimson/net/SocketConnection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 3a9cb1f58345c..2ad467b55d0b8 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) { -- 2.47.3