* Alexander Nozdrin <alik@stripped> [07/07/26 21:21]:
> ChangeSet@stripped, 2007-07-26 21:08:00+04:00, anozdrin@ibm. +4 -0
> Fix for BUG#28030: test im_instance_conf fails with an assert.
>
> The problem was a race condition on shutdown -- when IM got shutdown
> request while a guarded mysqld is starting. In this case the Guardian
> thread tried to stop the mysqld, but might fail if the mysqld hadn't
> created pid-file so far. When this happened, the mysqld-monitor thread
> didn't stop, so the assert in Thread_registry happened.
>
> The fix is to make several attempts to stop mysqld if it is active.
> diff -Nrup a/server-tools/instance-manager/guardian.cc
> b/server-tools/instance-manager/guardian.cc
> --- a/server-tools/instance-manager/guardian.cc 2007-02-23 14:13:48 +03:00
> +++ b/server-tools/instance-manager/guardian.cc 2007-07-26 21:07:57 +04:00
> @@ -438,7 +438,18 @@ void Guardian::stop_instances()
>
> /* Request mysqld to stop. */
>
> - instance->kill_mysqld(SIGTERM);
> + while (true)
> + {
> + if (!instance->kill_mysqld(SIGTERM))
> + break;
> +
> + if (!instance->is_active())
> + break;
> +
> + /* Sleep for 0.3 sec and check again. */
> +
> + my_sleep(300000);
> + }
Since you're waiting for the pid file, I would perhaps embed this
loop into kill_mysqld(). What do you think?
--
-- Konstantin Osipov Software Developer, Moscow, Russia
-- MySQL AB, www.mysql.com The best DATABASE COMPANY in the GALAXY