[MDEV-5145] Audit plugin crashes on PXC when selecting file as output type Created: 2013-10-16  Updated: 2013-10-28  Resolved: 2013-10-28

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Alex Vermulst Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None
Environment:

MariaDB Audit Plugin for MySQL 1.1.2 and Percona XtraDB Cluster 5.5.33-23.7.6.495



 Description   

I've loaded the audit plugin according to the instruction on the blog.

mysql>select * from information_schema.plugins where plugin_name like 'server%';
+--------------+----------------+---------------+-------------+---------------------+-----------------+------------------------+----------------------------+----------------------------+----------------+-------------+
| PLUGIN_NAME  | PLUGIN_VERSION | PLUGIN_STATUS | PLUGIN_TYPE | PLUGIN_TYPE_VERSION | PLUGIN_LIBRARY  | PLUGIN_LIBRARY_VERSION | PLUGIN_AUTHOR              | PLUGIN_DESCRIPTION         | PLUGIN_LICENSE | LOAD_OPTION |
+--------------+----------------+---------------+-------------+---------------------+-----------------+------------------------+----------------------------+----------------------------+----------------+-------------+
| SERVER_AUDIT | 1.1            | ACTIVE        | AUDIT       | 3.0                 | server_audit.so | 1.3                    |  Alexey Botchkov (MariaDB) | Audit the server activity. | GPL            | ON          |
+--------------+----------------+---------------+-------------+---------------------+-----------------+------------------------+----------------------------+----------------------------+----------------+-------------+
1 row in set (0.00 sec)

After installation, I've included the following parameters in the my.cnf.

server_audit_events=CONNECT,QUERY,TABLE
server_audit_file_path=/data/mysql/log/server_audit.log
server_audit_file_rotate_now=OFF
server_audit_file_rotate_size=1000000
server_audit_file_rotations=9
server_audit_logging=ON
server_audit_mode=1
server_audit_output_type=syslog
server_audit_syslog_facility=LOG_USER
server_audit_syslog_ident=mysql-server_auditing
server_audit_syslog_priority=LOG_INFO

mysql>show global variables like 'server_aud%';
+-------------------------------+----------------------------------+
| Variable_name                 | Value                            |
+-------------------------------+----------------------------------+
| server_audit_events           | CONNECT,QUERY,TABLE              |
| server_audit_excl_users       |                                  |
| server_audit_file_path        | /data/mysql/log/server_audit.log |
| server_audit_file_rotate_now  | OFF                              |
| server_audit_file_rotate_size | 1000000                          |
| server_audit_file_rotations   | 9                                |
| server_audit_incl_users       |                                  |
| server_audit_logging          | ON                               |
| server_audit_mode             | 1                                |
| server_audit_output_type      | ?                                |
| server_audit_syslog_facility  | LOG_USER                         |
| server_audit_syslog_ident     | mysql-server_auditing            |
| server_audit_syslog_info      |                                  |
| server_audit_syslog_priority  | LOG_INFO                         |
+-------------------------------+----------------------------------+

Everything seems fine, except that the audit file is not written. When setting the server_audit_output_type to FILE, MySQL crashes with signal 11.

mysql>show global variables like 'server_aud%';
+-------------------------------+----------------------------------+
| Variable_name                 | Value                            |
+-------------------------------+----------------------------------+
| server_audit_events           | CONNECT,QUERY,TABLE              |
| server_audit_excl_users       |                                  |
| server_audit_file_path        | /data/mysql/log/server_audit.log |
| server_audit_file_rotate_now  | OFF                              |
| server_audit_file_rotate_size | 1000000                          |
| server_audit_file_rotations   | 9                                |
| server_audit_incl_users       |                                  |
| server_audit_logging          | ON                               |
| server_audit_mode             | 1                                |
| server_audit_output_type      | ?                                |
| server_audit_syslog_facility  | LOG_USER                         |
| server_audit_syslog_ident     | mysql-server_auditing            |
| server_audit_syslog_info      |                                  |
| server_audit_syslog_priority  | LOG_INFO                         |
+-------------------------------+----------------------------------+
14 rows in set (0.00 sec)
 
mysql>set global server_audit_output_type=FILE;
Query OK, 0 rows affected (0.00 sec)
 
mysql>131016 19:05:50 server_audit: logging was stopped.
131016 19:05:50 server_audit: Output was redirected to 'file'
131016 19:05:50 server_audit: logging started to the file /data/mysql/log/server_audit.log.
17:05:50 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
Please help us make Percona Server better by reporting any
bugs at http://bugs.percona.com/
 
key_buffer_size=33554432
read_buffer_size=131072
max_used_connections=34
max_threads=502
thread_count=34
connection_count=34
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1131496 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0xcd1eb10
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 2b621830b098 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x7d6555]
/usr/sbin/mysqld(handle_fatal_signal+0x4b4)[0x6aeaa4]
/lib64/libpthread.so.0[0x307460eca0]
/usr/sbin/mysqld(my_hash_first+0x58)[0x7bd6d8]
/usr/sbin/mysqld(my_hash_search+0x11)[0x7bd721]
/usr/lib64/mysql/plugin/server_audit.so[0x2b61bfbfabd1]
/usr/lib64/mysql/plugin/server_audit.so[0x2b61bfbfc330]
/usr/lib64/mysql/plugin/server_audit.so[0x2b61bfbfc5c4]
/usr/sbin/mysqld[0x63cb3a]
/usr/sbin/mysqld(_Z18mysql_audit_notifyP3THDjjz+0xba)[0x63c76a]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x5cc)[0x5a11dc]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x167)[0x5a3277]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x14f)[0x63fbff]
/usr/sbin/mysqld(handle_one_connection+0x51)[0x63fde1]
/lib64/libpthread.so.0[0x307460683d]
/lib64/libc.so.6(clone+0x6d)[0x30736d4f8d]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (cf25990): set global server_audit_output_type=FILE
Connection ID (thread ID): 36
Status: NOT_KILLED
 
You may download the Percona Server operations manual by visiting
http://www.percona.com/software/percona-server/. You may find information
in the manual which will help you identify the cause of the crash.
131016 19:05:50 mysqld_safe Number of processes running now: 0
131016 19:05:50 mysqld_safe WSREP: not restarting wsrep node automatically
131016 19:05:50 mysqld_safe mysqld from pid file /data/mysql/var/mysql.pid ended

I've tried loading the debug version of the so, but that fails on PXC.

mysql>install plugin  server_audit SONAME 'server_audit.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/server_audit.so' (errno: 13 /usr/lib64/mysql/plugin/server_audit.so: undefined symbol: safe_mutex_init)



 Comments   
Comment by Alexey Botchkov [ 2013-10-28 ]

Fixed for the Audit plugin 1.1.3.
As the problem was about the error messages under Percona, i just disabled them there.
Though the more sophisticated solution is possible so the plugin will report errors on every server, but that needs some time to implement.
The fixing patch:
http://lists.askmonty.org/pipermail/commits/2013-October/005617.html

Generated at Thu Feb 08 07:02:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.