MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:March 22 2010 8:27am
Subject:bzr commit into mysql-trunk-bugfixing branch (kostja:3000) Bug#52266
View as plain text  
#At file:///opt/local/work/trunk-runtime/ based on revid:kostja@stripped

 3000 Konstantin Osipov	2010-03-22
      An attempt to fix Bug#52266 "Trying to lock unitialized mutex at 
      storage/myisam/ha_myisam.cc": when we call open_table_from_share()
      there is almost no reference to the share except the one 
      on MDL_lock, and this can go away quickly if someone
      releases a lock/table in a concurrent connection. Make sure we
      conservatively reference the share so that it doesn't
      disappear while we add a new table to its list of used
      tables.

    modified:
      sql/sql_base.cc
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-03-19 10:54:59 +0000
+++ b/sql/sql_base.cc	2010-03-22 08:27:50 +0000
@@ -2914,11 +2914,12 @@ bool open_table(THD *thd, TABLE_LIST *ta
     while (table_cache_count > table_cache_size && unused_tables)
       free_cache_entry(unused_tables);
 
+    reference_table_share(share);
     mysql_mutex_unlock(&LOCK_open);
 
     /* make a new table */
     if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
-      DBUG_RETURN(TRUE);
+      goto err_lock;
 
     error= open_table_from_share(thd, share, alias,
                                  (uint) (HA_OPEN_KEYFILE |
@@ -2945,20 +2946,19 @@ bool open_table(THD *thd, TABLE_LIST *ta
       else if (share->crashed)
         (void) ot_ctx->request_backoff_action(Open_table_context::OT_REPAIR);
 
-      DBUG_RETURN(TRUE);
+      goto err_lock;
     }
 
     if (open_table_entry_fini(thd, share, table))
     {
       closefrm(table, 0);
       my_free((uchar*)table, MYF(0));
-      DBUG_RETURN(TRUE);
+      goto err_lock;
     }
 
     mysql_mutex_lock(&LOCK_open);
     /* Add table to the share's used tables list. */
     table_def_add_used_table(thd, table);
-    reference_table_share(share);
   }
 
   mysql_mutex_unlock(&LOCK_open);
@@ -3018,6 +3018,8 @@ bool open_table(THD *thd, TABLE_LIST *ta
     table->file->extra(HA_EXTRA_DETACH_CHILDREN);
   DBUG_RETURN(FALSE);
 
+err_lock:
+  mysql_mutex_lock(&LOCK_open);
 err_unlock:
   release_table_share(share);
 err_unlock2:


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100322082750-z4uw9q9ftr7241rc.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (kostja:3000) Bug#52266Konstantin Osipov22 Mar