From e4972ac739be340babf6df4c6d2cd9b73ea38aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 22 Mar 2026 08:18:56 +0100 Subject: [PATCH] Fix hostgroups_unit-t hang: do not call MyHGM->init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MySQL_HostGroups_Manager::init() starts two background threads (HGCU_thread and GTID_syncer_thread) that run forever in a blocking loop. The destructor does not call shutdown() to stop them, so the test process hangs indefinitely after main() returns — std::thread destructor calls std::terminate() on joinable threads. Fix: skip init() entirely. The constructor alone sets up the internal SQLite3 database and all data structures needed for unit testing. The background threads are only needed for real connection pool management (connection reuse, GTID sync), not for server add/remove/ shun operations. --- test/tap/test_helpers/test_init.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/tap/test_helpers/test_init.cpp b/test/tap/test_helpers/test_init.cpp index 4c9cb064f..b3af46f82 100644 --- a/test/tap/test_helpers/test_init.cpp +++ b/test/tap/test_helpers/test_init.cpp @@ -183,10 +183,14 @@ int test_init_hostgroups() { } MyHGM = new MySQL_HostGroups_Manager(); - MyHGM->init(); + // NOTE: We intentionally do NOT call MyHGM->init() here. + // init() starts background threads (HGCU_thread, GTID_syncer) + // that run forever and would cause the test process to hang on + // exit. The constructor alone sets up the internal SQLite3 + // database and all data structures needed for unit testing. PgHGM = new PgSQL_HostGroups_Manager(); - PgHGM->init(); + // PgHGM->init() is a no-op, but we skip it for consistency. return 0; }