Subquery with tables in statement variables crash server

Bug #1284066 reported by Oleksandr "Sanja" Byelkin
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.1
Invalid
Undecided
Unassigned
5.5
Invalid
Undecided
Unassigned
5.6
Triaged
High
Vlad Lesin
5.7
Triaged
High
Vlad Lesin

Bug Description

Here is test case:
CREATE TABLE t1 (v1 INT, v2 INT);
INSERT INTO t1 VALUES (1,2);
INSERT INTO t1 VALUES (3,4);

              PREPARE stmt2
              FROM 'SELECT * FROM t1';
SET STATEMENT myisam_sort_buffer_size=400000,
              myisam_repair_threads=(select max(v1) from t1),
              sort_buffer_size=200000,
              binlog_format=row,
              keep_files_on_create=OFF,
              max_join_size=4444440000000 FOR
              EXECUTE stmt2;

I think EXECUTE and subquery with tables inside are important for reproduction.

Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

Forgot to mention that Percona-Server-5.6.15-rel63.0 (source code) was tested.

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :
Download full text (3.2 KiB)

This is easy to confirm as described:

Version: '5.6.15-debug' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
11:34:13 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 = 69196 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x2b11810
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 = 7fed6c188e38 thread_stack 0x40000
/home/openxs/dbs/p5.6/bin/mysqld(my_print_stacktrace+0x35)[0x96f9b5]
/home/openxs/dbs/p5.6/bin/mysqld(handle_fatal_signal+0x43b)[0x66c8fb]
/lib64/libpthread.so.0[0x3ffac0eeb0]
/home/openxs/dbs/p5.6/bin/mysqld(_Z12setup_tablesP3THDP23Name_resolution_contextP4ListI10TABLE_LISTEPS4_PS7_b+0xaf)[0x6ab0af]
/home/openxs/dbs/p5.6/bin/mysqld(_Z29setup_tables_and_check_accessP3THDP23Name_resolution_contextP4ListI10TABLE_LISTEPS4_PS7_bmm+0x37)[0x6ab527]
/home/openxs/dbs/p5.6/bin/mysqld(_ZN4JOIN7prepareEP10TABLE_LISTjP4ItemjP8st_orderS5_S3_P13st_select_lexP18st_select_lex_unit+0x6b0)[0x727ac0]
/home/openxs/dbs/p5.6/bin/mysqld(_ZN30subselect_single_select_engine7prepareEv+0x699)[0x82aed9]
/home/openxs/dbs/p5.6/bin/mysqld(_ZN14Item_subselect10fix_fieldsEP3THDPP4Item+0xad)[0x8299bd]
/home/openxs/dbs/p5.6/bin/mysqld(_ZN7set_var5checkEP3THD+0x159)[0x66b939]
/home/openxs/dbs/p5.6/bin/mysqld(_Z17sql_set_variablesP3THDP4ListI12set_var_baseE+0x4d)[0x66bf9d]
/home/openxs/dbs/p5.6/bin/mysqld(_Z21mysql_execute_commandP3THD+0x374)[0x704ad4]
/home/openxs/dbs/p5.6/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x6c8)[0x70d808]
/home/openxs/dbs/p5.6/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x16c1)[0x70ef71]
/home/openxs/dbs/p5.6/bin/mysqld(_Z10do_commandP3THD+0x175)[0x710775]
/home/openxs/dbs/p5.6/bin/mysqld(_Z24do_handle_one_connectionP3THD+0x1bd)[0x6d125d]
/home/openxs/dbs/p5.6/bin/mysqld(handle_one_connection+0x42)[0x6d12e2]
/home/openxs/dbs/p5.6/bin/mysqld(pfs_spawn_thread+0x127)[0xa06cf7]
/lib64/libpthread.so.0[0x3ffac06ccb]
/lib64/libc.so.6(clone+0x6d)[0x3ffa8e0c2d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fed2c006d90): SET STATEMENT myisam_sort_buffer_size=400000, myisam_repair_threads=(select max(v1) from t1), sort_buffer_size=200000, binlog_format=row, keep_files_on_create=OFF, max_join_size=4444440000000 FOR ...

Read more...

tags: added: set-statement
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

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

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.