From ae32aa970a1f4b79b4f1ebcb0948116f48b4f000 Mon Sep 17 00:00:00 2001 From: Calle Wilund Date: Wed, 22 Apr 2020 09:08:56 +0000 Subject: [PATCH] commitlog::read_log_file: Preserve subscription across reading Fixes #6265 Return type for read_log_file was previously changed from subscription to future<>, returning the previously returned subscriptions result of done(). But it did not preserve the subscription itself, which in turn will cause us to (in work::stream), call back into a deleted object. Message-Id: <20200422090856.5218-1-calle@scylladb.com> (cherry picked from commit 525b28332628b90b3d386e060ae6691cd4db62e9) --- db/commitlog/commitlog.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index 08e8ce7a5a..805db504f6 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -2133,8 +2133,9 @@ db::commitlog::read_log_file(const sstring& filename, const sstring& pfx, seasta }).handle_exception([w](auto ep) { w->s.set_exception(ep); }); - - return ret.done(); + // #6265 - must keep subscription alive. + auto res = ret.done(); + return res.finally([ret = std::move(ret)] {}); }); }