Function over userstat tables cause mysql to crash

Bug #1659992 reported by Juan Pablo Arruti on 2017-01-28
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Fix Released
High
Yura Sorokin
5.6
Fix Released
High
Yura Sorokin
5.7
Invalid
High
Yura Sorokin

Bug Description

Description:

Userstat tables combined with functions are causing crashes.

How to repeat:

userstat=ON

mysql> select @@version ;
+-------------+
| @@version |
+-------------+
| 5.6.34-79.1 |
+-------------+
1 row in set (0.00 sec)

mysql> use test ;
Database changed
mysql> DELIMITER $$
mysql> CREATE DEFINER=`root`@`localhost` FUNCTION `utility_get_global_variable`(in_name varchar(64)) RETURNS varchar(1024) CHARSET utf8
    -> DETERMINISTIC
    -> SQL SECURITY INVOKER
    -> BEGIN
    -> declare var_value varchar(1024);
    -> if @@global.version like '5.6.%' then
    -> select v.variable_value from information_schema.global_variables v where v.variable_name=in_name into var_value;
    -> else
    -> select v.variable_value from performance_schema.global_variables v where v.variable_name=in_name into var_value;
    -> end if;
    -> return var_value;
    -> END;
    -> $$
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql> select *
    -> from `information_schema`.`table_statistics` `s`
    -> where utility_get_global_variable('userstat')='ON';
ERROR 2013 (HY000): Lost connection to MySQL server during query

Log error messages:

18:46:22 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=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 69055 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f901a3b3000
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 = 7f902c881e00 thread_stack 0x40000
/opt/percona_server/5.6.34/bin/mysqld(my_print_stacktrace+0x2e)[0x8e801e]
/opt/percona_server/5.6.34/bin/mysqld(handle_fatal_signal+0x491)[0x6aa861]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7f902c2d3330]
/opt/percona_server/5.6.34/bin/mysqld(_Z11check_grantP3THDmP10TABLE_LISTbjb+0x75)[0x6c76c5]
/opt/percona_server/5.6.34/bin/mysqld(_Z23fill_schema_table_statsP3THDP10TABLE_LISTP4Item+0x17d)[0x750a9d]
/opt/percona_server/5.6.34/bin/mysqld(_Z24get_schema_tables_resultP4JOIN23enum_schema_table_state+0x2c1)[0x759311]
/opt/percona_server/5.6.34/bin/mysqld(_ZN4JOIN14prepare_resultEPP4ListI4ItemE+0xa5)[0x73c0e5]
/opt/percona_server/5.6.34/bin/mysqld(_ZN4JOIN4execEv+0x14f)[0x6ff06f]
/opt/percona_server/5.6.34/bin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x265)[0x73fbd5]
/opt/percona_server/5.6.34/bin/mysqld(_Z13handle_selectP3THDP13select_resultm+0x195)[0x73fea5]
/opt/percona_server/5.6.34/bin/mysqld[0x5d09c3]
/opt/percona_server/5.6.34/bin/mysqld(_Z21mysql_execute_commandP3THD+0x1d68)[0x71ebe8]
/opt/percona_server/5.6.34/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x598)[0x7222a8]
/opt/percona_server/5.6.34/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xef8)[0x723238]
/opt/percona_server/5.6.34/bin/mysqld(_Z24do_handle_one_connectionP3THD+0x15f)[0x6f6a2f]
/opt/percona_server/5.6.34/bin/mysqld(handle_one_connection+0x47)[0x6f6b17]
/opt/percona_server/5.6.34/bin/mysqld(pfs_spawn_thread+0x143)[0x936913]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8184)[0x7f902c2cb184]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f902a53237d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f900c822010): select * from `information_schema`.`table_statistics` `s` where utility_get_global_variable('userstat')='ON'
Connection ID (thread ID): 1
Status: NOT_KILLED

Jericho Rivera (jericho-rivera) wrote :

Can reproduce the crash based on description.

Changed in percona-server:
status: New → Confirmed
tags: added: i166014
tags: added: userstat

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1053

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

Other bug subscribers