From a4e9df1e4c687d17919bf37694be35c5c1a0e595 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 24 Oct 2023 14:38:49 -0500 Subject: [PATCH 1/2] GH-1815 Avoid deadlock on app_thread --- tests/test_read_only_trx.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_read_only_trx.cpp b/tests/test_read_only_trx.cpp index 27a6c6be1e..e1eb419ff6 100644 --- a/tests/test_read_only_trx.cpp +++ b/tests/test_read_only_trx.cpp @@ -117,10 +117,6 @@ void test_trxs_common(std::vector& specific_args, bool test_disable } FC_LOG_AND_DROP() BOOST_CHECK(!"app threw exception see logged error"); } ); - fc::scoped_exit> on_except = [&](){ - if (app_thread.joinable()) - app_thread.join(); - }; auto[prod_plug, chain_plug] = plugin_fut.get(); @@ -168,6 +164,7 @@ void test_trxs_common(std::vector& specific_args, bool test_disable } app->quit(); + app_thread.join(); } BOOST_CHECK_EQUAL( trace_with_except, 0u ); // should not have any traces with except in it From 894648dc5239a7095c5e0a89ee074817578d2407 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 24 Oct 2023 14:46:44 -0500 Subject: [PATCH 2/2] GH-1815 Call app->quit() before app_thread.join() --- tests/test_read_only_trx.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_read_only_trx.cpp b/tests/test_read_only_trx.cpp index e1eb419ff6..1495476779 100644 --- a/tests/test_read_only_trx.cpp +++ b/tests/test_read_only_trx.cpp @@ -117,6 +117,11 @@ void test_trxs_common(std::vector& specific_args, bool test_disable } FC_LOG_AND_DROP() BOOST_CHECK(!"app threw exception see logged error"); } ); + fc::scoped_exit> on_except = [&](){ + app->quit(); + if (app_thread.joinable()) + app_thread.join(); + }; auto[prod_plug, chain_plug] = plugin_fut.get(); @@ -162,9 +167,6 @@ void test_trxs_common(std::vector& specific_args, bool test_disable while ( (next_calls < num_pushes || num_get_account_calls < num_pushes) && fc::time_point::now() < hard_deadline ){ std::this_thread::sleep_for( 100ms ); } - - app->quit(); - app_thread.join(); } BOOST_CHECK_EQUAL( trace_with_except, 0u ); // should not have any traces with except in it