From b543ab4c768d3d73ffe8a7e50c1fb673a66e2ff6 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Mon, 15 Apr 2019 14:19:09 +0300 Subject: [PATCH] sstables: remove_temp_dir: do not return then_wrapped future f.get_exception makes the future invalid so it must not be returned. Instead, make_exception_future<> with the exception ptr. Fixes #4435. Signed-off-by: Benny Halevy Message-Id: <20190415111909.30499-1-bhalevy@scylladb.com> --- sstables/sstables.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 29681bb89f..ae22a9a7a7 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -2531,12 +2531,13 @@ future<> sstable::remove_temp_dir() { } sstlog.debug("Removing temp_dir={}", _temp_dir); return remove_file(*_temp_dir).then_wrapped([this] (future<> f) { - if (f.failed()) { - sstlog.error("Could not remove temporary directory: {}", f.get_exception()); - } else { + if (!f.failed()) { _temp_dir.reset(); + return make_ready_future<>(); } - return f; + auto ep = f.get_exception(); + sstlog.error("Could not remove temporary directory: {}", ep); + return make_exception_future<>(ep); }); }