diff options
author | mats@mysql.com <> | 2006-06-21 20:08:34 +0200 |
---|---|---|
committer | mats@mysql.com <> | 2006-06-21 20:08:34 +0200 |
commit | 9025bcfb4e62eed79125b82c0f00aa779813bfb6 (patch) | |
tree | f51a85d491bc23b2dfee994a7b996ff6ec7c3260 | |
parent | ffd8ea244d0246a43c4657ba7767cf9bcaf66e6a (diff) | |
parent | e57e87980b687d42649818e61164b8f3e7a77941 (diff) | |
download | mariadb-git-9025bcfb4e62eed79125b82c0f00aa779813bfb6.tar.gz |
Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/bk/fix-mysql-5.0
-rw-r--r-- | sql/slave.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index caeefc1ad3c..2b31d722f26 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1653,6 +1653,15 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, if (connect_to_master(thd, mysql, mi)) { my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql)); + /* + We need to clear the active VIO since, theoretically, somebody + might issue an awake() on this thread. If we are then in the + middle of closing and destroying the VIO inside the + mysql_close(), we will have a problem. + */ +#ifdef SIGNAL_WITH_VIO_CLOSE + thd->clear_active_vio(); +#endif mysql_close(mysql); DBUG_RETURN(1); } @@ -3709,6 +3718,17 @@ err: VOID(pthread_mutex_unlock(&LOCK_thread_count)); if (mysql) { + /* + Here we need to clear the active VIO before closing the + connection with the master. The reason is that THD::awake() + might be called from terminate_slave_thread() because somebody + issued a STOP SLAVE. If that happends, the close_active_vio() + can be called in the middle of closing the VIO associated with + the 'mysql' object, causing a crash. + */ +#ifdef SIGNAL_WITH_VIO_CLOSE + thd->clear_active_vio(); +#endif mysql_close(mysql); mi->mysql=0; } |