From: Date: January 4 2007 10:22pm Subject: bk commit into 5.1 tree (acurtis:1.2371) BUG#25396 List-Archive: http://lists.mysql.com/commits/17642 X-Bug: 25396 Message-Id: <200701042122.l04LMUtv023695@mail.mysql.com> 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:22:10-08:00, acurtis@stripped +2 -0 Bug#25396 "Valgrind leak in closecon_handlerton" Added a new plugin state to fix ndb shutdown issue found by valgrind sql/sql_plugin.cc@stripped, 2007-01-04 13:22:07-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:22:07-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 --- 1.40/sql/sql_plugin.cc 2007-01-04 13:22:28 -08:00 +++ 1.41/sql/sql_plugin.cc 2007-01-04 13:22:28 -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:22:28 -08:00 +++ 1.13/sql/sql_plugin.h 2007-01-04 13:22:28 -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. */