mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for BUG#17486: IM: race condition on exit.
The problem was that IM stoped guarded instances on shutdown, but didn't wait for them to stop. The fix is to wait for guarded instances to stop before exitting from the main thread. The idea is that Instance-monitoring thread should add itself to Thread_registry so that it will be taken into account on shutdown. However, Thread_registry should not signal it on shutdown in order to not interrupt wait()/waitpid().
This commit is contained in:
@ -169,7 +169,7 @@ int Instance_map::process_one_option(const LEX_STRING *group,
|
||||
if (!(instance= (Instance *) hash_search(&hash, (byte *) group->str,
|
||||
group->length)))
|
||||
{
|
||||
if (!(instance= new Instance()))
|
||||
if (!(instance= new Instance(thread_registry)))
|
||||
return 1;
|
||||
|
||||
if (instance->init(group) || add_instance(instance))
|
||||
@ -213,8 +213,10 @@ int Instance_map::process_one_option(const LEX_STRING *group,
|
||||
}
|
||||
|
||||
|
||||
Instance_map::Instance_map(const char *default_mysqld_path_arg):
|
||||
mysqld_path(default_mysqld_path_arg)
|
||||
Instance_map::Instance_map(const char *default_mysqld_path_arg,
|
||||
Thread_registry &thread_registry_arg):
|
||||
mysqld_path(default_mysqld_path_arg),
|
||||
thread_registry(thread_registry_arg)
|
||||
{
|
||||
pthread_mutex_init(&LOCK_instance_map, 0);
|
||||
}
|
||||
@ -333,7 +335,7 @@ int Instance_map::remove_instance(Instance *instance)
|
||||
int Instance_map::create_instance(const LEX_STRING *instance_name,
|
||||
const Named_value_arr *options)
|
||||
{
|
||||
Instance *instance= new Instance();
|
||||
Instance *instance= new Instance(thread_registry);
|
||||
|
||||
if (!instance)
|
||||
{
|
||||
|
Reference in New Issue
Block a user