From: Kefu Chai Date: Wed, 19 May 2021 10:02:59 +0000 (+0800) Subject: test/crimson/seastore: teardown in reactor X-Git-Tag: v17.1.0~1899^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9957b046c33b075d66c380862ec22fa0d32f5bd3;p=ceph.git test/crimson/seastore: teardown in reactor otherwise, we rely on the destructor of TMTestState to teardown the fixuture created in TMTestState::_init(), but TMTestState::_init() is called in reactor. the objects like seastar::metric_groups are supposed to be destroyed on the same thread where they are created. because they use thread local storage of storing persisting their status. if we destroy objects like seastar::metric_groups on different reactor or thread where they are created, we would have memory leak and unexpected behavior. Signed-off-by: Kefu Chai --- diff --git a/src/test/crimson/seastore/transaction_manager_test_state.h b/src/test/crimson/seastore/transaction_manager_test_state.h index 1d40279d818cd..9a1c51fdcbb7e 100644 --- a/src/test/crimson/seastore/transaction_manager_test_state.h +++ b/src/test/crimson/seastore/transaction_manager_test_state.h @@ -120,8 +120,10 @@ protected: } virtual seastar::future<> _teardown() { - return tm->close( - ).handle_error( + return tm->close().safe_then([this] { + _destroy(); + return seastar::now(); + }).handle_error( crimson::ct_error::assert_all{"Error in teardown"} ); } @@ -199,7 +201,9 @@ protected: } virtual seastar::future<> _teardown() { - return seastore->umount(); + return seastore->umount().then([this] { + seastore.reset(); + }); } virtual seastar::future<> _mount() {