mysqld can't startup when a plugin was installed

Bug #1011047 reported by yinfeng on 2012-06-10
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Percona Server moved to
Fix Released
Sergei Glushchenko
Fix Released
Sergei Glushchenko
Fix Released
Sergei Glushchenko
Fix Released
Sergei Glushchenko

Bug Description

i had installed daemon_example, then shutdown the server. i tried to restart mysqld, but failed eveytime. bellow is the backtrace in error log:
stack_bottom = 0x7fffbbbc5490 thread_stack 0x40000

To our surprise, in other machine everything is normal

Related branches

yinfeng (yinfeng-zwx) wrote :

version: percona server 5.5.18

yinfeng (yinfeng-zwx) wrote :

i just found i had set userstat in configure file. may be there's some bug related to userstat.

now i am able to repeat this bug every time:

in my.cnf

     userstat = 1

install plugin
     install plugin daemon_example soname '';

shutdown mysqld and restart it.

yinfeng (yinfeng-zwx) wrote :

a simple patch :
init_global_table_stats should be called before plugin_init

--- a/sql/ 2011-12-20 06:38:58.000000000 +0800
+++ b/sql/ 2012-06-10 12:31:49.000000000 +0800
@@ -3850,7 +3850,7 @@
+ init_global_table_stats();
   /* Setup logs */

@@ -4064,7 +4064,6 @@
   /* We have to initialize the storage engines before CSV logging */

- init_global_table_stats();

   if (ha_init())

Stewart Smith (stewart) on 2012-06-14
tags: added: userstats
summary: - mysqld can't startup when a plugin had being installed
+ mysqld can't startup when a plugin was installed
tags: added: contribution
Download full text (3.5 KiB)

Verified the bug. The crash happens because global_table_stats is not initialized when my_hash_insert is invoked on it resulting in segfault.

Complete backtrace:

#0 0x00007ffff6185fa5 in raise () from /lib/
#1 0x00007ffff6187428 in abort () from /lib/
#2 0x00007ffff617f002 in __assert_fail_base () from /lib/
#3 0x00007ffff617f0b2 in __assert_fail () from /lib/
#4 0x00000000008c5f36 in my_realloc (oldpoint=0x0, size=0, my_flags=my_flags@entry=80) at /media/Vone/percona-server/raghu/Percona-Server/mysys/my_malloc.c:81
#5 0x000000000089ee95 in alloc_dynamic (array=array@entry=0x1b8c168 <global_table_stats+40>) at /media/Vone/percona-server/raghu/Percona-Server/mysys/array.c:150
#6 0x00000000008a485c in my_hash_insert (info=0x1b8c140 <global_table_stats>, record=0x1e22a90 "mysql.plugin") at /media/Vone/percona-server/raghu/Percona-Server/mysys/hash.c:382
#7 0x00000000007451cc in handler::update_global_table_stats (this=0x1e20490) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#8 0x0000000000571623 in close_thread_table (thd=thd@entry=0x7fffffffb100, table_ptr=table_ptr@entry=0x7fffffffb1a0) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#9 0x0000000000571de6 in close_open_tables (thd=0x7fffffffb100) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#10 close_thread_tables (thd=0x7fffffffb100) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#11 0x00000000005815dd in close_mysql_tables (thd=0x7fffffffb100) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#12 0x00000000005dd16d in plugin_load (tmp_root=tmp_root@entry=0x7fffffffe310, argc=argc@entry=0x1a9915c <remaining_argc>, argv=argv@entry=0x1ddf700) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#13 0x00000000005deee6 in plugin_init (argc=0x1a9915c <remaining_argc>, argv=0x1ddf700, flags=0) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#14 0x0000000000529487 in init_server_components () at /media/Vone/percona-server/raghu/Percona-Server/sql/
#15 0x000000000052ab7a in mysqld_main (argc=22, argv=0x1ddf700) at /media/Vone/percona-server/raghu/Percona-Server/sql/
#16 0x000000000051d9dd in main (argc=<optimized out>, argv=<optimized out>) at /media/Vone/percona-server/raghu/Percona-Server/sql/


The fix provided by yinfeng is good, however, need to move the other init upwards too:

=== modified file 'Percona-Server/sql/'
--- Percona-Server/sql/ 2012-08-07 06:10:00 +0000
+++ Percona-Server/sql/ 2012-08-23 17:54:46 +0000
@@ -3947,6 +3947,9 @@
     sql_print_warning("ignore-builtin-innodb is deprecated "
                       "and will be removed in future releases.");

+ init_global_table_stats();
+ init_global_index_stats();
   if (plugin_init(&remaining_argc, remaining_argv,
                   (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
                   (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
@@ -4007,8 +4010,6 @@
   /* We have to initialize the storage engines b...


I experienced the same issue when trying to enable in Percona Server 5.5.28

tags: added: userstat
removed: userstats

Does not apply to PS 5.6.10 directly (yet), IMHO, as userstat is not there.

Confirmed on PS 5.1.68 also.

Sorry, current PS 5.6 from lp:

[openxs@centos percona-5.6]$ bzr version-info
revision-id: <email address hidden>
date: 2013-05-28 10:15:40 +0300
build-date: 2013-05-28 18:49:23 +0300
revno: 358
branch-nick: percona-5.6

is also affected, based on code review.

kernel (kernins) wrote :

Still affects 5.5.31 & 32 with SphinxSE plugin

Percona now uses JIRA for bug reports so this bug report is migrated to:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers