| Bug #48388 | additional logging for shutting down threads | ||
|---|---|---|---|
| Submitted: | 28 Oct 2009 18:43 | Modified: | 25 Apr 2011 19:06 |
| Reporter: | Lig Isler-Turmelle | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: General | Severity: | S4 (Feature request) |
| Version: | OS: | Any | |
| Assigned to: | Tatiana Azundris Nuernberg | CPU Architecture: | Any |
[28 Oct 2009 18:43]
Lig Isler-Turmelle
[20 Jan 2011 11:47]
Tatiana Azundris Nuernberg
mysqld_main:
...
mysql_mutex_lock(&LOCK_thread_count);
while (!ready_to_exit)
mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
...
clean_up(1);
mysqld_exit(0);
kill_server_thread:
// created in kill_mysql(). maybe.
handle_shutdown:
// Win only
kill_server:
// called from kill_server_thread() / handle_shutdown() / kill_broken_server()
if MYSQL_KILL_SIGNAL or !signal
print ER_NORMAL_SHUTDOWN
else
print ER_GOT_SIGNAL
close_connections();
if (sig != MYSQL_KILL_SIGNAL &&
sig != 0)
unireg_abort(1); // funky signal -> fail -> abort; terminal
else
unireg_end(); // regular shutdown; terminal
// terminal
unireg_abort:
// called from ... pretty much anywhere, generic fatal handler
clean_up(...)
mysqld_exit() // terminal
unireg_end:
// called from kill_server(), regular shutdown
clean_up(1); // may be terminal ...
pthread_exit(0); // if SIGNALS_DONT_BREAK_READ, this is main thr, exit() instead
// terminal
clean_up:
// called from mysqld_main(), unireg_abort(), unireg_end()
...
print_inf("shutdown complete")
...
MYSQL_CALLBACK(thread_scheduler, end, ());
mysql_client_plugin_deinit();
...
mysql_mutex_lock(&LOCK_thread_count);
DBUG_PRINT("quit", ("got thread count lock"));
ready_to_exit=1;
/* do the broadcast inside the lock to ensure that my_end() is not called */
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
rts -- if main thread hasn't killed us ...
mysqld_exit:
// called from unireg_abort(), or mysqld_main() if !EMBEDDED
wait_for_signal_thread_to_end();
...
clean_up_mutexes();
clean_up_error_log_mutex();
...
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(exit_code); /* purecov: inspected */
// terminal
my_end:
// myISAM debugging mostly
// called from mysqld_exit(), if !EMBEDDED
...
my_thread_end();
my_thread_global_end();
rts
my_thread_global_end:
// wait until all threads have exited, then destroy mutexes
// called from my_end()
rts
[10 Feb 2011 8:33]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/130961 3475 Tatiana Azundris Nurnberg 2011-02-10 [merge] merge & fix Bug#48388
[3 Mar 2011 12:08]
Tatiana Azundris Nuernberg
correcting, pushed for 5.6.2-m5
[25 Apr 2011 19:06]
Paul DuBois
Noted in 5.6.2 changelog. The server now writes thread shutdown messages to the error log during the shutdown procedure. CHANGESET - http://lists.mysql.com/commits/130961
