Bug #74860 handle_fatal_signal (sig=11) in generate_partition_syntax
Submitted: 14 Nov 2014 10:01 Modified: 10 Mar 2015 18:15
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:5.6.20, 5.6.23, 5.7.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[14 Nov 2014 10:01] Roel Van de Paar
Description:
+bt
#0  0x00007f02f89fd771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a9035e in my_write_core (sig=11) at /bzr/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000723688 in handle_fatal_signal (sig=11) at /bzr/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00000000009bd8c5 in generate_partition_syntax (part_info=0x7f025b82bd70, buf_length=0x7f02f8ff315c, use_sql_alloc=false, show_partition_options=true, create_info=0x0, alter_info=0x0, current_comment_start=0x7f025b819050 "\n/*!50100") at /bzr/mysql-5.6/sql/sql_partition.cc:2658
#5  0x0000000000814553 in store_create_info (thd=0x7f0265724000, table_list=0x7f025b81f0f0, packet=0x7f02f8ff3270, create_info_arg=0x0, show_database=false) at/bzr/mysql-5.6/sql/sql_show.cc:1781
#6  0x00000000008113c6 in mysqld_show_create (thd=0x7f0265724000, table_list=0x7f025b81f0f0) at /bzr/mysql-5.6/sql/sql_show.cc:883
#7  0x00000000007d0dee in mysql_execute_command (thd=0x7f0265724000) at /bzr/mysql-5.6/sql/sql_parse.cc:3266
#8  0x00000000007d8fa4 in mysql_parse (thd=0x7f0265724000, rawbuf=0x7f025b81f010 "SHOW CREATE TABLE t1", length=20, parser_state=0x7f02f8ff4e70) at /bzr/mysql-5.6/sql/sql_parse.cc:6245
#9  0x00000000007cc557 in dispatch_command (command=COM_QUERY, thd=0x7f0265724000, packet=0x7f0265762001 "SHOW CREATE TABLE t1", packet_length=20) at /bzr/mysql-5.6/sql/sql_parse.cc:1332
#10 0x00000000007cb646 in do_command (thd=0x7f0265724000) at /bzr/mysql-5.6/sql/sql_parse.cc:1034
#11 0x0000000000793a61 in do_handle_one_connection (thd_arg=0x7f0265724000) at /bzr/mysql-5.6/sql/sql_connect.cc:982
#12 0x000000000079354a in handle_one_connection (arg=0x7f0265724000) at /bzr/mysql-5.6/sql/sql_connect.cc:898
#13 0x0000000000ade888 in pfs_spawn_thread (arg=0x7f02f2349b00) at /bzr/mysql-5.6/storage/perfschema/pfs.cc:1860
#14 0x00007f02f89f8df3 in start_thread () from /lib64/libpthread.so.0
#15 0x00007f02f78ca01d in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(s1 int)PARTITION BY LIST (s1) (PARTITION p1 VALUES IN (1),PARTITION p2 VALUES IN (2),PARTITION p3 VALUES IN (3),PARTITION p4 VALUES IN (4),PARTITION p5 VALUES IN (5));
lock TABLE t1 write;
ALTER TABLE t1 ADD PARTITION(PARTITION p2 VALUES IN (0,0,23,0,25,0,27,0,29,0,31,0,33,0,35,0,37,0,39,0));
SHOW CREATE TABLE t1;
[14 Nov 2014 11:56] Umesh Shastry
Hello Roel,

Thank you for the bug report and test case.
Confirmed that 5.6.23/5.7.6 debug builds are affected.

Thanks,
Umesh
[14 Nov 2014 11:57] Umesh Shastry
// 5.6.23

scripts/mysql_install_db --basedir=/data/ushastry/server/mysql-advanced-5.6.23 --datadir=/tmp/bug --user=root
bin/mysqld-debug --basedir=/data/ushastry/server/mysql-advanced-5.6.23 --tmpdir=/tmp/bug --datadir=/tmp/bug --core --socket=/tmp/mysql.sock  --port=3306 --log-error=/tmp/bug/log.err --maximum-bulk_insert_buffer_size=1M --maximum-join_buffer_size=1M --maximum-max_heap_table_size=1M --maximum-max_join_size=1M --maximum-myisam_max_sort_file_size=1M --maximum-myisam_mmap_size=1M --maximum-myisam_sort_buffer_size=1M --maximum-optimizer_trace_max_mem_size=1M --maximum-preload_buffer_size=1M --maximum-query_alloc_block_size=1M --maximum-query_prealloc_size=1M --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M --maximum-read_rnd_buffer_size=1M --maximum-sort_buffer_size=1M --maximum-tmp_table_size=1M --maximum-transaction_alloc_block_size=1M --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode=ONLY_FULL_GROUP_BY --user=root 2>&1 &

(gdb) bt
#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000affdab in my_write_core (sig=11) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/mysys/stacktrace.c:422
#2  0x000000000077ebbc in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x0000000000a27d0e in generate_partition_syntax (part_info=0x7f6100040480, buf_length=0x7f6129d7e43c, use_sql_alloc=false, show_partition_options=true, create_info=0x0, alter_info=0x0,
    current_comment_start=0x7f610000c1c0 "\n/*!50100") at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_partition.cc:2658
#5  0x00000000008744ed in store_create_info (thd=0x21c7e00, table_list=0x7f6100006e60, packet=0x7f6129d7efc0, create_info_arg=0x0, show_database=false)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_show.cc:1781
#6  0x00000000008711c4 in mysqld_show_create (thd=0x21c7e00, table_list=0x7f6100006e60) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_show.cc:880
#7  0x000000000082f4c9 in mysql_execute_command (thd=0x21c7e00) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:3266
#8  0x0000000000837fa9 in mysql_parse (thd=0x21c7e00, rawbuf=0x7f6100006d80 "SHOW CREATE TABLE t1", length=20, parser_state=0x7f6129d80680)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:6357
#9  0x000000000082a92b in dispatch_command (command=COM_QUERY, thd=0x21c7e00, packet=0x22f6551 "SHOW CREATE TABLE t1", packet_length=20)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1332
#10 0x0000000000829990 in do_command (thd=0x21c7e00) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1034
#11 0x00000000007f0d8f in do_handle_one_connection (thd_arg=0x21c7e00) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:982
#12 0x00000000007f0860 in handle_one_connection (arg=0x21c7e00) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:898
#13 0x0000000000e5f509 in pfs_spawn_thread (arg=0x22b9c80) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/storage/perfschema/pfs.cc:1860
#14 0x0000003deb0079d1 in start_thread (arg=0x7f6129d81700) at pthread_create.c:301
#15 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

[root@cluster-repo mysql-advanced-5.6.23]# more docs/INFO_SRC
revision-id: michael.izioumtchenko@oracle.com-20141106152508-nntohvuco3v1rjjx
date: 2014-11-06 16:25:08 +0100
build-date: 2014-11-06 18:00:43 +0100
revno: 6243
branch-nick: daily-5.6
MySQL source 5.6.23
[14 Nov 2014 11:57] Umesh Shastry
//5.7.6

bin/mysql_install_db --basedir=/data/ushastry/server/mysql-advanced-5.7.6 --datadir=/tmp/bug --user=root -v
bin/mysqld-debug --basedir=/data/ushastry/server/mysql-advanced-5.7.6 --tmpdir=/tmp/bug --datadir=/tmp/bug --core-file --socket=/tmp/mysql.sock --port=3306 --log-error=/tmp/bug/log.err --maximum-bulk_insert_buffer_size=1M --maximum-join_buffer_size=1M --maximum-max_heap_table_size=1M --maximum-max_join_size=1M --maximum-myisam_max_sort_file_size=1M --maximum-myisam_mmap_size=1M --maximum-myisam_sort_buffer_size=1M --maximum-optimizer_trace_max_mem_size=1M --maximum-preload_buffer_size=1M --maximum-query_alloc_block_size=1M --maximum-query_prealloc_size=1M --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M --maximum-read_rnd_buffer_size=1M --maximum-sort_buffer_size=1M --maximum-tmp_table_size=1M --maximum-transaction_alloc_block_size=1M --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode=ONLY_FULL_GROUP_BY --user=root 2>&1 &

(gdb) bt
#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000f990a1 in my_write_core (sig=11) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/mysys/stacktrace.c:247
#2  0x000000000092d7cc in handle_fatal_signal (sig=11) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x0000000000eaa7b7 in generate_partition_syntax (part_info=0x7f4eb0040430, buf_length=0x7f4ee6afa25c, use_sql_alloc=false, show_partition_options=true, create_info=0x0, alter_info=0x0,
    current_comment_start=0x7f4eb002dbc0 "\n/*!50100") at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_partition.cc:2628
#5  0x0000000000d0730c in store_create_info (thd=0x7f4eb0000d30, table_list=0x7f4eb0005db8, packet=0x7f4ee6afade0, create_info_arg=0x0, show_database=false)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_show.cc:1823
#6  0x0000000000d03e91 in mysqld_show_create (thd=0x7f4eb0000d30, table_list=0x7f4eb0005db8) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_show.cc:902
#7  0x0000000000cb5c36 in mysql_execute_command (thd=0x7f4eb0000d30) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:3115
#8  0x0000000000cbce6a in mysql_parse (thd=0x7f4eb0000d30, parser_state=0x7f4ee6afc660) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:5397
#9  0x0000000000cb0f2c in dispatch_command (command=COM_QUERY, thd=0x7f4eb0000d30, packet=0x7f4eb0009a61 "SHOW CREATE TABLE t1", packet_length=20)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:1249
#10 0x0000000000cafbd4 in do_command (thd=0x7f4eb0000d30) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:833
#11 0x0000000000dbe89c in handle_connection (arg=0x35385c0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#12 0x000000000138347f in pfs_spawn_thread (arg=0x35d71a0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/perfschema/pfs.cc:2137
#13 0x0000003deb0079d1 in start_thread (arg=0x7f4ee6afd700) at pthread_create.c:301
#14 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb)

[root@cluster-repo mysql-advanced-5.7.6]# more docs/INFO_SRC
revision-id: knut.hatlen@oracle.com-20141030112312-87lkavvjlg9cqtvz
date: 2014-10-30 12:23:12 +0100
build-date: 2014-10-30 12:30:43 +0100
revno: 9156
branch-nick: daily-trunk-el6
MySQL source 5.7.6
[23 Feb 2015 9:11] Mattias Jonsson
Posted by developer:
 
Base bug fixed and pushed which also fixes this bug and included the test case from here.
[27 Feb 2015 9:24] Roel Van de Paar
Thank you Mattias! What version is the bugfix in?
[10 Mar 2015 18:15] Jon Stephens
Documented fix in the 5.6.24 and 5.7.7 changelogs, as follows:

    A number of ALTER TABLE statements that attempted to add a
    partition, column, or index to a partitioned table while a write
    lock was in effect for this table were not handled correctly.

Also fixes BUG#74451, BUG#74478, BUG#74491, BUG#74560, BUG#74746, BUG#74841, and BUG#74869.

Closed.
[16 Mar 2015 12:37] Daniel Price
Posted by developer:
 
The base bug under which this bug is fixed (Bug #19856162 / MySQL Bug #74451) is also fixed in trunk (5.8.0). The changelog entry has been updated to include the 5.8.0 version number.