List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:May 23 2008 9:07pm
Subject:bk commit into 6.0 tree (aelkin:1.2639) BUG#36929
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of aelkin.  When aelkin does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-05-23 22:07:27+03:00, aelkin@stripped +2 -0
  Bug #36929  	crash in kill_zombie_dump_threads-> THD::awake() with replication tests
  
  There was a crash in THD::awake () at attempt to access concurrently resetable
  by the host thread THD::mysys_var.
  
  Fixed with forcing the host thread to reset only after acquiring LOCK_delete mutex.

  sql/scheduler.cc@stripped, 2008-05-23 22:07:24+03:00, aelkin@stripped +6 -1
    Resetting mysys_var only if the current connection is getting over.

  sql/sql_class.cc@stripped, 2008-05-23 22:07:24+03:00, aelkin@stripped +7 -1
    Moving resetting of mysys_var under LOCK_delete protection.

diff -Nrup a/sql/scheduler.cc b/sql/scheduler.cc
--- a/sql/scheduler.cc	2008-05-14 16:33:27 +03:00
+++ b/sql/scheduler.cc	2008-05-23 22:07:24 +03:00
@@ -222,7 +222,12 @@ void thd_scheduler::thread_detach()
   if (thread_attached)
   {
     THD* thd = (THD*)list.data;
-    thd->mysys_var= NULL;
+    /*
+      resetting if it's not connection close in which
+      case it must be guarded with pthread_mutex_lock(&LOCK_delete);
+    */
+    if (thd->killed != THD::KILL_CONNECTION)
+      thd->mysys_var= NULL;
     thread_attached= FALSE;
 #ifndef DBUG_OFF
     /*
diff -Nrup a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc	2008-05-21 13:04:22 +03:00
+++ b/sql/sql_class.cc	2008-05-23 22:07:24 +03:00
@@ -902,6 +902,13 @@ THD::~THD()
   DBUG_ENTER("~THD()");
   /* Ensure that no one is using THD */
   pthread_mutex_lock(&LOCK_delete);
+  /*
+    resetting this pointer to the thread specific memory is guarded by
+    the same mutex as a killer thread acquires in order to determine
+    if this victim thread is required the violent leave (whenever the
+    pointer is not NULL)
+  */
+  mysys_var= NULL;
   pthread_mutex_unlock(&LOCK_delete);
   add_to_status(&global_status_var, &status_var);
 
@@ -929,7 +936,6 @@ THD::~THD()
 #ifdef USING_TRANSACTIONS
   free_root(&transaction.mem_root,MYF(0));
 #endif
-  mysys_var=0;					// Safety (shouldn't be needed)
   pthread_mutex_destroy(&LOCK_delete);
 #ifndef DBUG_OFF
   dbug_sentry= THD_SENTRY_GONE;
Thread
bk commit into 6.0 tree (aelkin:1.2639) BUG#36929Andrei Elkin23 May