From: Aditya A Date: November 8 2012 10:08am Subject: bzr push into mysql-5.6 branch (aditya.a:4553 to 4554) Bug#14234028 List-Archive: http://lists.mysql.com/commits/145201 X-Bug: 14234028 Message-Id: <20121108100828.4541.99809.4554@aditya-ThinkPad-T420> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4554 Aditya A 2012-11-08 [merge] Bug#14234028 - CRASH DURING SHUTDOWN WITH BACKGROUND PURGE THREAD Analysis --------- my_stat() calls stat() and if the stat() call fails we try to set the variable my_errno which is actually a thread specific data . We try to get the address of this thread specific data using my_pthread_getspecifc(),but for the purge thread we have not defined any thread specific data so it returns null and when dereferencing null we get a segmentation fault. init_available_charsets() seen in the core stack is invoked through pthread_once() .pthread_once is used for one time initialization.Since free_charsets() is called before innodb plugin shutdown ,purge thread calls init_avaliable_charsets() which leads to the crash. Fix --- Call free_charsets() after the innodb plugin shutdown,since purge threads are still using the charsets. modified: sql/mysqld.cc 4553 Aditya A 2012-11-08 [merge] Bug#11751825 - OPTIMIZE PARTITION RECREATES FULL TABLE INSTEAD JUST PARTITION [NULL MERGE from 5.5 ] === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc revid:aditya.a@stripped +++ b/sql/mysqld.cc revid:aditya.a@stripped @@ -1771,7 +1771,6 @@ void clean_up(bool print_message) item_user_lock_free(); lex_free(); /* Free some memory */ item_create_cleanup(); - free_charsets(); if (!opt_noacl) { #ifdef HAVE_DLOPEN @@ -1826,6 +1825,7 @@ void clean_up(bool print_message) my_atomic_rwlock_destroy(&opt_binlog_max_flush_queue_time_lock); my_atomic_rwlock_destroy(&global_query_id_lock); my_atomic_rwlock_destroy(&thread_running_lock); + free_charsets(); mysql_mutex_lock(&LOCK_thread_count); DBUG_PRINT("quit", ("got thread count lock")); ready_to_exit=1; No bundle (reason: useless for push emails).