Bug #36098 Audit plugin (wl 3771) feature disabled in 6.0
Submitted: 15 Apr 2008 17:48 Modified: 6 Mar 2010 23:20
Reporter: Davi Arnaut (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:6.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: pushbuild, sporadic, test failure

[15 Apr 2008 17:48] Davi Arnaut
Description:
The variables.test crashes on 6.0-runtime the the following message:

Version: '6.0.5-alpha-pb237-debug-log'  socket: '/dev/shm/pbtmp-n_mix-110/master.sock'  port: 11100  MySQL Pushbuild Edition, build 237
safe_mutex: Trying to lock mutex at sql_plugin.cc, line 1763, when the mutex was already locked at sql_plugin.cc, line 2119 in thread T@3

It seems that it is due to calling my_error with LOCK_plugin locked in find_sys_var -> intern_find_sys_var. my_error calls mysql_audit_general -> mysql_audit_notify -> tries to grab LOCK_plugin.

How to repeat:
https://intranet.mysql.com/secure/pushbuild/getlog.pl?dir=mysql-6.0-runtime&entry=darnaut@...
[16 Apr 2008 12:49] Davi Arnaut
Also causes a crash on the deprecated_features test:

main.deprecated_features       [ fail ]

mysqltest: At line 6: query 'select @@table_type='MyISAM'' failed with wrong errno 2013: 'Lost connection to MySQL server during query', instead of 1193...

The result from queries just before the failure was:
set global log_bin_trust_routine_creators=1;
ERROR HY000: Unknown system variable 'log_bin_trust_routine_creators'

CURRENT_TEST: main.deprecated_features
safe_mutex: Trying to lock mutex at sql_plugin.cc, line 1763, when the mutex was already locked at sql_plugin.cc, line 2119 in thread T@20
080416 12:03:33 - mysqld got signal 6 ;
[..]

/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld(safe_mutex_lock+0xf3)[0x8861dbf]
/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld(_Z24plugin_foreach_with_maskP3THDPFcS0_PP13st_plugin_intPvEijS4_+0xa7)[0x84bf7df]
/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld(_Z18mysql_audit_notifyP3THDjjz+0xa2)[0x84cb858]
/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld[0x82dd698]
/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld(my_message_sql+0x15b)[0x82dd7f5]
/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld(my_error+0x16e)[0x884665a]
/data0/pushbuild/pb1/pb/mysql-6.0-runtime/239/mysql-6.0.5-alpha-pb239/sql/mysqld(_Z19intern_find_sys_varPKcjb+0x7e)[0x8303134]
[20 Apr 2008 8:06] 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/45707

ChangeSet@1.2630, 2008-04-20 12:06:51+04:00, kostja@bodhi.(none) +1 -0
  Disable the auditing code in my_message_ql until Bug#36098 is fixed.
  Bug#36098 is variables.test crash on double whopper
[20 Apr 2008 10:57] Konstantin Osipov
The patch only disables the feature, to avoid the test failure.
A correct fix requires a design decision.
[20 Apr 2008 13:01] Bugs System
Pushed into 6.0.6-alpha
[25 Mar 2009 20:17] Sergei Golubchik
In the merge with signal/resignal patch the failing (disabled) code disappeared. It should be added back, in a safe fashion, of course.

See bzr diff -r revid:alik@sun.com-20090219130605-m8en5l4gi5co5z3r..revid:marc.alff@sun.com-20090223145318-a8bwqsrqcpwiljk7 mysqld.cc
[7 Apr 2009 20:20] 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/71593

2735 Sergei Golubchik	2009-04-07
      Bug #36098 Audit plugin (wl 3771) feature disabled in 6.0
      avoid recusrive locking of LOCK_plugin
     @ include/mysql/plugin_audit.h
        fix incorrect version
     @ sql/log.cc
        move the common code to a shared header
     @ sql/mysqld.cc
        restore the deleted functionality
     @ sql/set_var.cc
        remove unused parameter
     @ sql/sql_audit.h
        two inline convenience functions
     @ sql/sql_parse.cc
        use a simplified convenience call
     @ sql/sql_plugin.cc
        unlock LOCK_plugin for plugin->init() call, add missing OOM check,
        issue "unknown variable" error in find_sys_var, not down the stack
[23 Apr 2009 7:18] Bugs System
Pushed into 6.0.11-alpha (revid:alik@sun.com-20090423070920-e5lq3vrrqi016z2c) (version source revid:alik@sun.com-20090423070920-e5lq3vrrqi016z2c) (merge vers: 6.0.11-alpha) (pib:6)
[30 Apr 2009 18:45] Paul DuBois
Noted in 6.0.11 changelogs.

The audit plugin was not receiving MYSQL_AUDIT_GENERAL_ERROR events.
[25 Jan 2010 16:21] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100125161344-09j1psvpzf0n7l23) (version source revid:alik@sun.com-20100125155614-mwwazksp2h0gbp4p) (merge vers: 6.0.14-alpha) (pib:16)
[25 Jan 2010 16:22] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100125161225-mpr7xlu4kvx45e1i) (version source revid:svoj@sun.com-20100122083751-x2lhrzwzzqgzx6m6) (pib:16)
[6 Mar 2010 10:51] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100126043948-pgixuzm01snoxbby) (merge vers: 5.5.99-m3) (pib:16)
[6 Mar 2010 23:20] Paul DuBois
6.0 problem. No 5.5 changelog entry needed.