Fix hostgroups_unit-t hang: do not call MyHGM->init()

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.
pull/5506/head
René Cannaò 2 months ago
parent f772c104de
commit e4972ac739

@ -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;
}

Loading…
Cancel
Save