List:Commits« Previous MessageNext Message »
From:antony Date:January 4 2007 9:24pm
Subject:bk commit into 5.1 tree (acurtis:1.2371) BUG#25396
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony 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, 2007-01-04 13:24:03-08:00, acurtis@stripped +3 -0
  Bug#25396
    "Valgrind leak in closecon_handlerton"
    Added a new plugin state to fix ndb shutdown issue found by valgrind

  BUILD/compile-amd64-valgrind-max@stripped, 2007-01-04 13:24:01-08:00, acurtis@stripped +24 -0
    New BitKeeper file ``BUILD/compile-amd64-valgrind-max''

  BUILD/compile-amd64-valgrind-max@stripped, 2007-01-04 13:24:01-08:00, acurtis@stripped +0 -0

  sql/sql_plugin.cc@stripped, 2007-01-04 13:24:01-08:00, acurtis@stripped +19 -7
    Bug25396
    new state to fix ndb shutdown issue found by valgrind

  sql/sql_plugin.h@stripped, 2007-01-04 13:24:01-08:00, acurtis@stripped +1 -0
    Bug25396
    new state to fix ndb shutdown issue found by valgrind

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	acurtis
# Host:	ltamd64.xiphis.org
# Root:	/home/antony/work2/valgrind-5.1
--- New file ---
+++ BUILD/compile-amd64-valgrind-max	07/01/04 13:24:01
#! /bin/sh

path=`dirname $0`
. "$path/SETUP.sh"

extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
extra_configs="$amd64_configs $debug_configs $max_configs"

. "$path/FINISH.sh"

if test -z "$just_print"
then
  set +v +x
  echo "\
******************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
--enable-assembler. When Valgrind detects an error involving an assembly
function (for example an uninitialized value used as an argument of an
assembly function), Valgrind will not print the stacktrace and 'valgrind
--gdb-attach=yes' will not work either. If you need a stacktrace in those
cases, you have to run BUILD/compile-pentium-valgrind-max with the
--disable-assembler argument.
******************************************************************************"
fi


--- 1.40/sql/sql_plugin.cc	2007-01-04 13:24:18 -08:00
+++ 1.41/sql/sql_plugin.cc	2007-01-04 13:24:18 -08:00
@@ -552,6 +552,7 @@
   plugin->ref_count--;
   if (plugin->state == PLUGIN_IS_DELETED && ! plugin->ref_count)
   {
+    plugin->state= PLUGIN_IS_TERMINATING;
     plugin_deinitialize(plugin);
     plugin_del(plugin);
   }
@@ -689,6 +690,7 @@
     {
       if (plugin_initialize(tmp))
       {
+	    tmp->state= PLUGIN_IS_TERMINATING;
         plugin_deinitialize(tmp);
         plugin_del(tmp);
       }
@@ -793,23 +795,31 @@
 
 void plugin_shutdown(void)
 {
-  uint i;
+  uint i, plugin_count= plugin_array.elements;
+  struct st_plugin_int **plugins;
   DBUG_ENTER("plugin_shutdown");
 
+  plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * plugin_count);
+  for (i= 0; i < plugin_count; i++)
+    if ((plugins[i]= dynamic_element(&plugin_array, i, struct st_plugin_int *))
+	    ->state != PLUGIN_IS_UNINITIALIZED)
+      plugins[i]->state= PLUGIN_IS_TERMINATING;
+
   /*
     We loop through all plugins and call deinit() if they have one.
   */
-  for (i= 0; i < plugin_array.elements; i++)
-  {
-    struct st_plugin_int *tmp= dynamic_element(&plugin_array, i,
-                                               struct st_plugin_int *);
-    plugin_deinitialize(tmp);
+  for (i= 0; i < plugin_count; i++)
+    if (plugins[i]->state == PLUGIN_IS_TERMINATING)
+      plugin_deinitialize(plugins[i]);
 
-  }
+  for (i= 0; i < plugin_count; i++)
+    plugin_del(plugins[i]);
 
   for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
     hash_free(&plugin_hash[i]);
   delete_dynamic(&plugin_array);
+  my_afree(plugins);
+
   for (i= 0; i < plugin_dl_array.elements; i++)
   {
     struct st_plugin_dl *tmp= dynamic_element(&plugin_dl_array, i,
@@ -870,6 +880,7 @@
   rw_unlock(&THR_LOCK_plugin);
   DBUG_RETURN(FALSE);
 deinit:
+  tmp->state= PLUGIN_IS_TERMINATING;
   plugin_deinitialize(tmp);
   plugin_del(tmp);
 err:
@@ -915,6 +926,7 @@
   }
   else
   {
+    plugin->state= PLUGIN_IS_TERMINATING;
     plugin_deinitialize(plugin);
     plugin_del(plugin);
   }

--- 1.12/sql/sql_plugin.h	2007-01-04 13:24:18 -08:00
+++ 1.13/sql/sql_plugin.h	2007-01-04 13:24:18 -08:00
@@ -42,6 +42,7 @@
 #define PLUGIN_IS_DELETED       2
 #define PLUGIN_IS_UNINITIALIZED 4
 #define PLUGIN_IS_READY         8
+#define PLUGIN_IS_TERMINATING   16
 
 /* A handle for the dynamic library containing a plugin or plugins. */
 
Thread
bk commit into 5.1 tree (acurtis:1.2371) BUG#25396antony4 Jan