Bug #76436 handle_fatal_signal (sig=11) in st_select_lex::merge_derived
Submitted: 23 Mar 2015 0:23 Modified: 25 Mar 2015 22:10
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.7.6, 5.7.8, 8.0.0 OS:Any
Assigned to: CPU Architecture:Any

[23 Mar 2015 0:23] Roel Van de Paar
Description:
2015-03-23T00:20:46.790286Z 0 [Note] /sda/MS-mysql-5.7.6-m16-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.6-m16-debug'  socket: '/sda/MS-mysql-5.7.6-m16-linux-x86_64-debug/socket.sock'  port: 10430  MySQL Community Server (GPL)
00:20:49 UTC - mysqld got signal 11 ;

+bt
#0  0x00007f15c4d46771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013a521c in my_write_core (sig=11) at /bzr/mysql-5.7.6-m16_dbg/mysys/stacktrace.c:247
#2  0x0000000000bb713c in handle_fatal_signal (sig=11) at /bzr/mysql-5.7.6-m16_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00000000010ed4f8 in st_select_lex::merge_derived (this=0x7f1520c2c050, thd=0x7f1520c1a000, derived_table=0x7f1520c2cc68) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_resolver.cc:2341
#5  0x000000000129d1a0 in Sql_cmd_insert_base::mysql_prepare_insert_check_table (this=0x7f1520c2d1e8, thd=0x7f1520c1a000, table_list=0x7f1520c2cc68, fields=..., select_insert=true) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_insert.cc:1005
#6  0x000000000129d75b in Sql_cmd_insert_base::mysql_prepare_insert (this=0x7f1520c2d1e8, thd=0x7f1520c1a000, table_list=0x7f1520c2cc68, insert_table_ref=0x7f15c533cb30, values=0x0, select_insert=true) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_insert.cc:1159
#7  0x000000000129f5be in Sql_cmd_insert_select::mysql_insert_select_prepare (this=0x7f1520c2d1e8, thd=0x7f1520c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_insert.cc:1874
#8  0x00000000012a2f72 in Sql_cmd_insert_select::execute (this=0x7f1520c2d1e8, thd=0x7f1520c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_insert.cc:3085
#9  0x00000000010a580d in mysql_execute_command (thd=0x7f1520c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:3204
#10 0x00000000010aae7a in mysql_parse (thd=0x7f1520c1a000, parser_state=0x7f15c533de00) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:5129
#11 0x00000000010a0bd4 in dispatch_command (command=COM_QUERY, thd=0x7f1520c1a000, packet=0x7f1520c46011 "insert into v1 SELECT 3", packet_length=23) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:1249
#12 0x000000000109f925 in do_command (thd=0x7f1520c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:835
#13 0x00000000011c2fd9 in handle_connection (arg=0x7f15bbbf78c0) at /bzr/mysql-5.7.6-m16_dbg/sql/conn_handler/connection_handler_per_thread.cc:298
#14 0x00000000013d2299 in pfs_spawn_thread (arg=0x7f15bcbb2d50) at /bzr/mysql-5.7.6-m16_dbg/storage/perfschema/pfs.cc:2147
#15 0x00007f15c4d41df3 in start_thread () from /lib64/libpthread.so.0
#16 0x00007f15c3a0b1ad in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(a DATETIME)PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
insert into v1 SELECT 3;
[23 Mar 2015 8:36] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Confirmed that 5.7.6, 5.7.8 and 5.8.0 release builds are affected.

Thanks,
Umesh
[23 Mar 2015 8:37] MySQL Verification Team
// 5.7.6, 5.7.8, 5.8.0 release builds are affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76435 -v
bin/mysqld --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76435 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.6/76435/log.err 2>&1 &

- build

commit: e1298eb6a8e2247361533811930a07fde7aff618
date: 2015-02-26 15:29:31 +0100
build-date: 2015-02-26 15:35:58 +0100
short: e1298eb
branch: mysql-5.7.6-m16-release

MySQL source 5.7.6

(gdb) bt
#0  0x00007ff24b246771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000006f64d4 in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/signal_handler.cc:220
#2  <signal handler called>
#3  0x0000000000b24ecb in st_select_lex::merge_derived (this=0x7ff1f80051d0, thd=<optimized out>, derived_table=0x7ff1f8005dc0)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_resolver.cc:2335
#4  0x0000000000c53b6f in Sql_cmd_insert_base::mysql_prepare_insert_check_table (this=0x7ff1f8006338, thd=0x7ff1f8000b40, table_list=0x7ff1f8005dc0, fields=..., select_insert=<optimized out>)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_insert.cc:1005
#5  0x0000000000c53d9d in Sql_cmd_insert_base::mysql_prepare_insert (this=0x7ff1f8006338, thd=0x7ff1f8000b40, table_list=0x7ff1f8005dc0, insert_table_ref=0x7ff240a6f618, values=0x0,
    select_insert=true) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_insert.cc:1159
#6  0x0000000000c5448f in Sql_cmd_insert_select::mysql_insert_select_prepare (this=<optimized out>, thd=<optimized out>)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_insert.cc:1874
#7  0x0000000000c5464a in Sql_cmd_insert_select::execute (this=0x7ff1f8006338, thd=0x7ff1f8000b40) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_insert.cc:3085
#8  0x0000000000af1e1c in mysql_execute_command (thd=0x7ff1f8000b40) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:3204
#9  0x0000000000af5248 in mysql_parse (thd=0x7ff1f8000b40, parser_state=<optimized out>) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:5129
#10 0x0000000000af6788 in dispatch_command (command=COM_QUERY, thd=0x7ff1f8000b40, packet=0x7ff1f8009c21 "insert into v1 SELECT 3", packet_length=23)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:1249
#11 0x0000000000bb94a4 in handle_connection (arg=<optimized out>) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#12 0x0000000000f79aba in pfs_spawn_thread (arg=0x4282770) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/perfschema/pfs.cc:2147
#13 0x00007ff24b241df3 in start_thread () from /lib64/libpthread.so.0
#14 0x00007ff249f0d47d in clone () from /lib64/libc.so.6
[23 Mar 2015 8:37] MySQL Verification Team
// 5.7.8 

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.8 --datadir=/export/umesh/mysql-5.7.8/76435 -v
bin/mysqld --basedir=/export/umesh/mysql-5.7.8 --datadir=/export/umesh/mysql-5.7.8/76435 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.8/76435/log.err 2>&1 &
more ~umshastr/.mysql_secret 

- build

commit: 91153f3385c4917a215aa4c7818b3f6265608286
date: 2015-03-20 14:48:27 +0100
build-date: 2015-03-20 18:03:24 +0100
short: 91153f3
branch: mysql-5.7

MySQL source 5.7.8

(gdb) bt
#0  0x00007fe5d2876771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000007817d5 in handle_fatal_signal (sig=11) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/signal_handler.cc:220
#2  <signal handler called>
#3  0x0000000000c60cac in st_select_lex::merge_derived (this=this@entry=0x7fe5700052a0, thd=thd@entry=0x7fe570000b40, derived_table=derived_table@entry=0x7fe570005eb8)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_resolver.cc:2394
#4  0x0000000000d8710f in Sql_cmd_insert_base::mysql_prepare_insert_check_table (this=this@entry=0x7fe570006440, thd=thd@entry=0x7fe570000b40, table_list=table_list@entry=0x7fe570005eb8,
    fields=..., select_insert=select_insert@entry=true) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_insert.cc:1009
#5  0x0000000000d872df in Sql_cmd_insert_base::mysql_prepare_insert (this=this@entry=0x7fe570006440, thd=thd@entry=0x7fe570000b40, table_list=0x7fe570005eb8,
    insert_table_ref=insert_table_ref@entry=0x7fe5bacab7a0, values=values@entry=0x0, select_insert=select_insert@entry=true)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_insert.cc:1163
#6  0x0000000000d89dd1 in Sql_cmd_insert_select::mysql_insert_select_prepare (this=this@entry=0x7fe570006440, thd=thd@entry=0x7fe570000b40)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_insert.cc:1878
#7  0x0000000000d89f9f in Sql_cmd_insert_select::execute (this=0x7fe570006440, thd=0x7fe570000b40)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_insert.cc:3092
#8  0x0000000000c29d7b in mysql_execute_command (thd=thd@entry=0x7fe570000b40) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:4495
#9  0x0000000000c2fdf8 in mysql_parse (thd=thd@entry=0x7fe570000b40, parser_state=parser_state@entry=0x7fe5bacac7b0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:5201
#10 0x0000000000c310f7 in dispatch_command (thd=thd@entry=0x7fe570000b40, com_data=com_data@entry=0x7fe5bacace00, command=COM_QUERY)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:1280
#11 0x0000000000c3202f in do_command (thd=thd@entry=0x7fe570000b40) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:851
#12 0x0000000000ce39b0 in handle_connection (arg=arg@entry=0x33184e0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/conn_handler/connection_handler_per_thread.cc:299
#13 0x00000000011502b3 in pfs_spawn_thread (arg=0x337e160) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/storage/perfschema/pfs.cc:2147
#14 0x00007fe5d2871df3 in start_thread () from /lib64/libpthread.so.0
#15 0x00007fe5d153d47d in clone () from /lib64/libc.so.6
(gdb)
[23 Mar 2015 8:38] MySQL Verification Team
// 5.8.0

bin/mysql_install_db --basedir=/export/umesh/mysql-5.8.0 --datadir=/export/umesh/mysql-5.8.0/76435 -v
bin/mysqld --basedir=/export/umesh/mysql-5.8.0 --datadir=/export/umesh/mysql-5.8.0/76435 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.8.0/76435/log.err 2>&1 &
more ~umshastr/.mysql_secret 

- build

commit: b48798db34fbcaf5dbb5c8ae7ef738afeb60eccc
date: 2015-03-20 14:52:33 +0100
build-date: 2015-03-20 17:03:10 +0100
short: b48798d
branch: mysql-trunk

MySQL source 5.8.0

(gdb) bt
#0  0x00007fbe48b4f771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000776eb5 in handle_fatal_signal (sig=11) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/signal_handler.cc:221
#2  <signal handler called>
#3  0x0000000000c4db6c in st_select_lex::merge_derived (this=this@entry=0x7fbdf00207d0, thd=thd@entry=0x7fbdf0012310, derived_table=derived_table@entry=0x7fbdf00213e8)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_resolver.cc:2396
#4  0x0000000000d764af in Sql_cmd_insert_base::mysql_prepare_insert_check_table (this=this@entry=0x7fbdf0021970, thd=thd@entry=0x7fbdf0012310, table_list=table_list@entry=0x7fbdf00213e8,
    fields=..., select_insert=select_insert@entry=true) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_insert.cc:1010
#5  0x0000000000d7667f in Sql_cmd_insert_base::mysql_prepare_insert (this=this@entry=0x7fbdf0021970, thd=thd@entry=0x7fbdf0012310, table_list=0x7fbdf00213e8,
    insert_table_ref=insert_table_ref@entry=0x7fbe3d3777d0, values=values@entry=0x0, select_insert=select_insert@entry=true)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_insert.cc:1164
#6  0x0000000000d79151 in Sql_cmd_insert_select::mysql_insert_select_prepare (this=this@entry=0x7fbdf0021970, thd=thd@entry=0x7fbdf0012310)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_insert.cc:1879
#7  0x0000000000d7931f in Sql_cmd_insert_select::execute (this=0x7fbdf0021970, thd=0x7fbdf0012310)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_insert.cc:3093
#8  0x0000000000c1762b in mysql_execute_command (thd=thd@entry=0x7fbdf0012310) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:4450
#9  0x0000000000c1d418 in mysql_parse (thd=thd@entry=0x7fbdf0012310, parser_state=parser_state@entry=0x7fbe3d3787b0)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:5158
#10 0x0000000000c1e4d5 in dispatch_command (thd=thd@entry=0x7fbdf0012310, com_data=com_data@entry=0x7fbe3d378e00, command=COM_QUERY)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:1245
#11 0x0000000000c1f51f in do_command (thd=thd@entry=0x7fbdf0012310) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:814
#12 0x0000000000cd0e50 in handle_connection (arg=arg@entry=0x2ebae70)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/conn_handler/connection_handler_per_thread.cc:300
#13 0x00000000010f2123 in pfs_spawn_thread (arg=0x2f20b70) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/storage/perfschema/pfs.cc:2147
#14 0x00007fbe48b4adf3 in start_thread () from /lib64/libpthread.so.0
#15 0x00007fbe4781647d in clone () from /lib64/libc.so.6
(gdb)
[23 Mar 2015 8:39] MySQL Verification Team
// 5.6.25 build not affected
[25 Mar 2015 22:10] Paul DuBois
Noted in 5.7.8, 5.8.0 changelogs.

The ORDER BY clause of a derived table was appended to an INSERT
statement, but ordering for a table being inserted into is irrelevant
and caused a server exit.
[18 Jun 2016 21:25] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0