From 71626b4729c26ba9d88f194510e44b5d64a6fa3c Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 20 Sep 2021 13:59:30 +0000 Subject: [PATCH] crimson/net: fix dangling addrvec in bind(), the repeat_until_value() part. This is a follow-up to commit 480273082718230d64d2c068db1b22f44997bdc8. `seastar::do_with()` doesn't extend the life-time of the callable's ```cpp auto do_with_impl(T1&& rv1, T2&& rv2, More&&... more) { // ... auto&& just_values = cherry_pick_tuple(idx(), std::move(all)); auto&& just_func = std::move(std::get(std::move(all))); // ... auto task = std::apply( [](auto&&... x) { return std::make_unique>(std::forward(x)...); }, std::move(just_values)); auto fut = std::apply(just_func, task->data()); // ... } ``` closure. This means the `addrs` needs to be captured by value also by the lambda passed to `repeat_until_value()`. Signed-off-by: Radoslaw Zarzynski --- src/crimson/net/SocketMessenger.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crimson/net/SocketMessenger.cc b/src/crimson/net/SocketMessenger.cc index 13af0434a0f..8f8ffd8f19a 100644 --- a/src/crimson/net/SocketMessenger.cc +++ b/src/crimson/net/SocketMessenger.cc @@ -135,7 +135,7 @@ SocketMessenger::bind(const entity_addrvec_t& addrs) using crimson::common::local_conf; return seastar::do_with(int64_t{local_conf()->ms_bind_retry_count}, [this, addrs] (auto& count) { - return seastar::repeat_until_value([this, &addrs, &count] { + return seastar::repeat_until_value([this, addrs, &count] { assert(count >= 0); return try_bind(addrs, local_conf()->ms_bind_port_min, -- 2.39.5