Bug #67829 mysqld got signal 11 when doing explain plan
Submitted: 6 Dec 2012 19:02 Modified: 6 Dec 2012 20:16
Reporter: Younes Naguib Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:5.6.8-rc OS:Linux (2.6.32-220.13.1.el6.x86_64)
Assigned to: CPU Architecture:Any
Tags: Explain plan

[6 Dec 2012 19:02] Younes Naguib
Description:
MySQL crashes when running an explain plan:
18:57:04 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.

key_buffer_size=402653184
read_buffer_size=2097152
max_used_connections=1
max_threads=151
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 = 1013722 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x2ccf540
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 = 7fb3fc0b2e18 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x8ba725]
/usr/sbin/mysqld(handle_fatal_signal+0x4a4)[0x65a454]
/lib64/libpthread.so.0(+0xf4a0)[0x7fb3ffa684a0]
/usr/sbin/mysqld(mi_extra+0x25)[0x8e51b5]
/usr/sbin/mysqld(_ZN4JOIN5resetEv+0x89)[0x6f2ab9]
/usr/sbin/mysqld(_ZN18st_select_lex_unit7prepareEP3THDP13select_resultm+0x9b)[0x7367ab]
/usr/sbin/mysqld[0x7c99f2]
/usr/sbin/mysqld(_ZN7Explain18explain_subqueriesEP13select_result+0x21d)[0x7cb13d]
/usr/sbin/mysqld(_ZN7Explain4sendEv+0x1bd)[0x7cb65d]
/usr/sbin/mysqld(_Z27explain_query_specificationP3THDP4JOIN+0x1a5)[0x7cb875]
/usr/sbin/mysqld(_ZN4JOIN7explainEv+0x1b8)[0x6f1038]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x230)[0x6f2eb0]
/usr/sbin/mysqld[0x7c999e]
/usr/sbin/mysqld(_Z24explain_query_expressionP3THDP13select_result+0x8e)[0x7c9ace]
/usr/sbin/mysqld[0x6d0187]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x23e6)[0x6d2f56]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x307)[0x6d5807]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xae7)[0x6d63a7]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0xcf)[0x6a502f]
/usr/sbin/mysqld(handle_one_connection+0x47)[0x6a5157]
/usr/sbin/mysqld(pfs_spawn_thread+0x139)[0x93d1e9]
/lib64/libpthread.so.0(+0x77f1)[0x7fb3ffa607f1]
/lib64/libc.so.6(clone+0x6d)[0x7fb3fe7caccd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fb3c0005dc0): is an invalid pointer
Connection ID (thread ID): 1
Status: NOT_KILLED

How to repeat:
EXPLAIN
SELECT *
FROM (  SELECT * 
	FROM mysql.`user` u
	GROUP BY u.`User`
	UNION ALL 
	SELECT * FROM mysql.`user` uu
)d
[6 Dec 2012 19:41] Valeriy Kravchuk
I'd call this an awful regression bug in 5.6.8. Easily repeatable:

Thread pointer: 0x1520550
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 = 7ff78c13fe28 thread_stack 0x40000
/home/openxs/dbs/5.6/bin/mysqld(my_print_stacktrace+0x35)[0x8c8385]
/home/openxs/dbs/5.6/bin/mysqld(handle_fatal_signal+0x40b)[0x64a3db]
/lib64/libpthread.so.0(+0xf500)[0x7ff7914ca500]
/home/openxs/dbs/5.6/bin/mysqld(mi_extra+0x25)[0x8f2425]
/home/openxs/dbs/5.6/bin/mysqld(_ZN4JOIN5resetEv+0x89)[0x6ea009]
/home/openxs/dbs/5.6/bin/mysqld(_ZN18st_select_lex_unit7prepareEP3THDP13select_resultm+0x9b)[0x731d6b]
/home/openxs/dbs/5.6/bin/mysqld[0x7cdc72]
/home/openxs/dbs/5.6/bin/mysqld(_ZN7Explain18explain_subqueriesEP13select_result+0x368)[0x7cf748]
/home/openxs/dbs/5.6/bin/mysqld(_ZN7Explain4sendEv+0x1b3)[0x7cfe53]
/home/openxs/dbs/5.6/bin/mysqld(_Z27explain_query_specificationP3THDP4JOIN+0x194)[0x7d0054]
/home/openxs/dbs/5.6/bin/mysqld(_ZN4JOIN7explainEv+0x1b0)[0x6eaf70]
/home/openxs/dbs/5.6/bin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x1f6)[0x6ebc36]
/home/openxs/dbs/5.6/bin/mysqld[0x7cdc1e]
/home/openxs/dbs/5.6/bin/mysqld(_Z24explain_query_expressionP3THDP13select_result+0x66)[0x7cdd26]
/home/openxs/dbs/5.6/bin/mysqld[0x6c8070]
/home/openxs/dbs/5.6/bin/mysqld(_Z21mysql_execute_commandP3THD+0x13ef)[0x6cbb8f]
/home/openxs/dbs/5.6/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x4a7)[0x6cf727]
/home/openxs/dbs/5.6/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xafc)[0x6d02ec]
/home/openxs/dbs/5.6/bin/mysqld(_Z24do_handle_one_connectionP3THD+0x10d)[0x69a47d]
/home/openxs/dbs/5.6/bin/mysqld(handle_one_connection+0x42)[0x69a5b2]
/home/openxs/dbs/5.6/bin/mysqld(pfs_spawn_thread+0x136)[0xac25d6]
/lib64/libpthread.so.0(+0x7851)[0x7ff7914c2851]
/lib64/libc.so.6(clone+0x6d)[0x7ff79022c11d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7ff75c004ee0): EXPLAIN SELECT * FROM (  SELECT *  FROM mysql.`user` u GROUP BY u.`User` UNION ALL  SELECT * FROM mysql.`user` uu )d
Connection ID (thread ID): 1
Status: NOT_KILLED

This is what we get on 5.5.28:

mysql> EXPLAIN
    -> SELECT *
    -> FROM (  SELECT *
    ->  FROM mysql.`user` u
    ->  GROUP BY u.`User`
    ->  UNION ALL
    ->  SELECT * FROM mysql.`user` uu
    -> )d;
+----+--------------+------------+------+---------------+------+---------+------
+------+---------------------------------+
| id | select_type  | table      | type | possible_keys | key  | key_len | ref
| rows | Extra                           |
+----+--------------+------------+------+---------------+------+---------+------
+------+---------------------------------+
|  1 | PRIMARY      | <derived2> | ALL  | NULL          | NULL | NULL    | NULL
|    6 |                                 |
|  2 | DERIVED      | u          | ALL  | NULL          | NULL | NULL    | NULL
|    4 | Using temporary; Using filesort |
|  3 | UNION        | uu         | ALL  | NULL          | NULL | NULL    | NULL
|    4 |                                 |
| NULL | UNION RESULT | <union2,3> | ALL  | NULL          | NULL | NULL    | NUL
L | NULL |                                 |
+----+--------------+------------+------+---------------+------+---------+------
+------+---------------------------------+
4 rows in set (5.41 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.28    |
+-----------+
1 row in set (0.11 sec)
[6 Dec 2012 20:02] MySQL Verification Team
trunk:

+----+--------------+------------+------+---------------+------+---------+------+------+---------------------------------+
| id | select_type  | table      | type | possible_keys | key  | key_len | ref  | rows | Extra                           |
+----+--------------+------------+------+---------------+------+---------+------+------+---------------------------------+
|  1 | PRIMARY      | <derived2> | ALL  | NULL          | NULL | NULL    | NULL |   10 | NULL                            |
|  2 | DERIVED      | u          | ALL  | NULL          | NULL | NULL    | NULL |    5 | Using temporary; Using filesort |
|  3 | UNION        | uu         | ALL  | NULL          | NULL | NULL    | NULL |    5 | NULL                            |
| NULL | UNION RESULT | <union2,3> | ALL  | NULL          | NULL | NULL    | NULL | NULL | Using temporary                 |
+----+--------------+------------+------+---------------+------+---------+------+------+---------------------------------+
4 rows in set (0.01 sec)

mysql> select version();
+---------------+
| version()     |
+---------------+
| 5.7.1-m11-log |
+---------------+
1 row in set (0.00 sec)
[6 Dec 2012 20:16] MySQL Verification Team
woops, i meant, 5.6.8 gave above crash. 5.6.bzr is fixed, i just tested it.  so, this is a duplicate of some other bug, whose number i'll paste here shortly.
[7 Dec 2012 7:44] Erlend Dahl
Shane, bug#67230 and bug#67630 (dups, fixed in 5.6.9) look similar.
[7 Dec 2012 7:47] MySQL Verification Team
yup, that's it.  private bug, it says "Noted in 5.6.9, 5.7.0 changelogs."
[7 Dec 2012 14:43] MySQL Verification Team
Valerii, my friend,

Please, stop crying on FB !!! 

As you see this was fixed before you filed a bug !!!