Bug #33345 loading example handler from command line kills server

Submitted: 18 Dec 2007 20:33 Modified: 7 Apr 2008 17:25
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S6 (Debug Builds)
Version:5.1 OS:Any
Assigned to: Oleksandr Byelkin CPU Architecture:Any
Tags: plugin

[18 Dec 2007 20:33] Oleksandr Byelkin
Description:
Try to load example plugin from command line and with debug assertion.

mysqld: sql_plugin.cc:556: st_plugin_int* plugin_find_internal(const LEX_STRING*, int): Assertion `(&LOCK_plugin)->count > 0 && pthread_equal(pthread_self(), (&LOCK_plugin)->thread)' failed.

How to repeat:
1. build 5.1 debug (for example in /home/bell/mysql/bk/work-variable-5.1/)
2. cd mysql-test
3. ./mysql-test-run plugin
3. /home/bell/mysql/bk/work-variable-5.1/sql/mysqld --no-defaults --skip-grant-tables --basedir=/home/bell/mysql/bk/work-variable-5.1/mysql-test --datadir=/home/bell/mysql/bk/work-variable-5.1/mysql-test/var/master-data --loose-skip-innodb --loose-skip-ndbcluster --tmpdir=. --core-file --language=/home/bell/mysql/bk/work-variable-5.1/sql/share/english --character-sets-dir=/home/bell/mysql/bk/work-variable-5.1/sql/share/charsets --plugin_dir=/home/bell/mysql/bk/work-variable-5.1/storage/example/.libs/ --plugin_load=ha_example.so
[19 Dec 2007 6:07] Oleksandr Byelkin
This patch fixes the problem:
===== sql/sql_plugin.cc 1.78 vs edited =====
--- 1.78/sql/sql_plugin.cc      2007-12-13 13:49:55 +02:00
+++ edited/sql/sql_plugin.cc    2007-12-19 08:02:27 +02:00
@@ -1422,6 +1422,7 @@
 #endif
     case ';':
       name.str[name.length]= '\0';
+      pthread_mutex_lock(&LOCK_plugin);
       if (str != &dl)  // load all plugins in named module
       {
         dl= name;
@@ -1445,6 +1446,7 @@
         if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
           goto error;
       }
+      pthread_mutex_unlock(&LOCK_plugin);
       name.length= dl.length= 0;
       dl.str= NULL; name.str= p= buffer;
       str= &name;
@@ -1464,6 +1466,7 @@
   }
   DBUG_RETURN(FALSE);
 error:
+  pthread_mutex_unlock(&LOCK_plugin);
   sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
                   name.str, dl.str);
   DBUG_RETURN(TRUE);
[19 Dec 2007 8:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/40177

ChangeSet@1.2680, 2007-12-19 10:13:13+02:00, bell@desktop.sanja.is.com.ua +1 -0
  Mutex protection added for loading plugins. (BUG#33345)
[29 Mar 2008 16:11] Bugs System
Pushed into 5.1.24-rc
[1 Apr 2008 19:09] Paul DuBois
Noted in 5.1.24 changelog.

Loading plugins via command-line options to mysqld could cause an
assertion failure. 

Resetting report to Patch queued waiting for push into 6.0.x.
[3 Apr 2008 13:01] Bugs System
Pushed into 6.0.5-alpha
[7 Apr 2008 17:25] Paul DuBois
Noted in 6.0.5 changelog.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.058 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.