Bug #78260 handle_fatal_signal (sig=11) in Partition_helper::ph_read_range_first on SELECT
Submitted: 28 Aug 2015 11:17 Modified: 15 Sep 2015 15:29
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.7.8 (RC2), 5.7.9, 8.0.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: opt

[28 Aug 2015 11:17] Roel Van de Paar
Description:
+bt
#0  0x00007fe24143e771 in __pthread_kill (threadid=<optimized out>, signo=11) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000761db4 in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/signal_handler.cc:220
#2  <signal handler called>
#3  0x0000000000beb600 in Partition_helper::ph_read_range_first (this=0x7fe17d037d10, start_key=0x7fe17d037b18, end_key=0x7fe17d037b38, eq_range_arg=<optimized out>, sorted=<optimized out>) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/partitioning/partition_handler.cc:2859
#4  0x00000000007a1215 in handler::multi_range_read_next (this=0x7fe17d037a30, range_info=0x7fe241a364c8) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/handler.cc:6081
#5  0x00000000007a4f58 in DsMrr_impl::dsmrr_next (this=0x7fe17d037c88, range_info=0x7fe241a364c8) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/handler.cc:6442
#6  0x0000000000da5f32 in QUICK_RANGE_SELECT::get_next (this=0x7fe17d021540) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/opt_range.cc:11032
#7  0x0000000000bf0f08 in rr_quick (info=0x7fe17d08e750) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/records.cc:396
#8  0x0000000000c50b72 in sub_select (join=0x7fe17d08e030, qep_tab=0x7fe17d08e700, end_of_records=<optimized out>) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_executor.cc:1265
#9  0x0000000000c5042a in do_select (join=0x7fe17d08e030) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_executor.cc:938
#10 JOIN::exec (this=0x7fe17d08e030) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_executor.cc:200
#11 0x0000000000cb8268 in handle_query (thd=0x7fe17d018000, lex=0x7fe17d01a058, result=0x7fe17d02ba30, added_options=1, removed_options=0) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_select.cc:184
#12 0x0000000000c7a483 in execute_sqlcom_select (thd=0x7fe17d018000, all_tables=<optimized out>) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_parse.cc:4843
#13 0x0000000000c7bdbb in mysql_execute_command (thd=0x7fe17d018000) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_parse.cc:2521
#14 0x0000000000c7f7e8 in mysql_parse (thd=0x7fe17d018000, parser_state=<optimized out>) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_parse.cc:5255
#15 0x0000000000c80a82 in dispatch_command (thd=0x7fe17d018000, com_data=0x7fe241a37da0, command=COM_QUERY) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_parse.cc:1272
#16 0x0000000000c81c54 in do_command (thd=0x7fe17d018000) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/sql_parse.cc:852
#17 0x0000000000d486ac in handle_connection (arg=<optimized out>) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/sql/conn_handler/connection_handler_per_thread.cc:300
#18 0x0000000000ee7690 in pfs_spawn_thread (arg=0x7fe2373eb820) at /export/home/pb2/build/sb_0-15961582-1437395640.67/mysql-5.7.8-rc/storage/perfschema/pfs.cc:2178
#19 0x00007fe241439df5 in start_thread (arg=0x7fe241a38700) at pthread_create.c:308
#20 0x00007fe2401031ad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
create TABLE t1(a int,b int,c int)partition by list(a) partitions 2 (partition x123 values in (11,12),partition x234 values in (0,1));
alter table t1 add unique(a);
SELECT * FROM t1 WHERE a BETWEEN '2000-01-01 01:02:00' AND '2000-01-01 01:03:00';
[28 Aug 2015 11:32] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.7.9 release build is affected.

Thanks,
Umesh
[28 Aug 2015 11:34] MySQL Verification Team
// 5.7.9 - release build affected

bin/mysql_install_db --insecure --basedir=/export/umesh/server/binaries/mysql-advanced-5.7.9 --datadir=/export/umesh/server/binaries/mysql-advanced-5.7.9/78260 -v
bin/mysqld --no-defaults --basedir=/export/umesh/server/binaries/mysql-advanced-5.7.9 --datadir=/export/umesh/server/binaries/mysql-advanced-5.7.9/78260 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/server/binaries/mysql-advanced-5.7.9/78260/log.err 2>&1 &

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.7.9: cat docs/INFO_SRC
commit: e4928d41773503a7b93ab0886a1f5efa88a4e4e4
date: 2015-08-26 21:01:11 +0530
build-date: 2015-08-26 18:05:18 +0200
short: e4928d4
branch: mysql-5.7

MySQL source 5.7.9

(gdb) bt
#0  0x00007f8caaa3d771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x000000000079f125 in handle_fatal_signal (sig=11) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/signal_handler.cc:220
#2  <signal handler called>
#3  0x0000000000bcc6a3 in Partition_helper::ph_read_range_first (this=0x7f8c3c011a40, start_key=0x7f8c3c011848, end_key=0x7f8c3c011868, eq_range_arg=<optimized out>, sorted=<optimized out>)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/partitioning/partition_handler.cc:2859
#4  0x00000000007e4d66 in handler::multi_range_read_next (this=0x7f8c3c011760, range_info=0x7f8c7d59b6b0)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/handler.cc:6153
#5  0x0000000000d72feb in QUICK_RANGE_SELECT::get_next (this=0x7f8c3c01d6a0) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/opt_range.cc:11039
#6  0x0000000000bcf87a in rr_quick (info=0x7f8c3c928a80) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/records.cc:398
#7  0x0000000000c2dc4b in sub_select (join=0x7f8c3c928360, qep_tab=0x7f8c3c928a30, end_of_records=<optimized out>)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_executor.cc:1264
#8  0x0000000000c26ca7 in do_select (join=0x7f8c3c928360) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_executor.cc:937
#9  JOIN::exec (this=0x7f8c3c928360) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_executor.cc:199
#10 0x0000000000c9158d in handle_query (thd=thd@entry=0x7f8c3c000b50, lex=lex@entry=0x7f8c3c002c00, result=result@entry=0x7f8c3c006e20, added_options=added_options@entry=0,
    removed_options=removed_options@entry=0) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_select.cc:184
#11 0x00000000007621d6 in execute_sqlcom_select (thd=thd@entry=0x7f8c3c000b50, all_tables=<optimized out>)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_parse.cc:4941
#12 0x0000000000c56c16 in mysql_execute_command (thd=thd@entry=0x7f8c3c000b50, first_level=first_level@entry=true)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_parse.cc:2597
#13 0x0000000000c5a515 in mysql_parse (thd=thd@entry=0x7f8c3c000b50, parser_state=parser_state@entry=0x7f8c7d59c7b0)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_parse.cc:5350
#14 0x0000000000c5aeba in dispatch_command (thd=thd@entry=0x7f8c3c000b50, com_data=com_data@entry=0x7f8c7d59ce00, command=COM_QUERY)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_parse.cc:1284
#15 0x0000000000c5c72f in do_command (thd=thd@entry=0x7f8c3c000b50) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/sql_parse.cc:852
#16 0x0000000000d126a0 in handle_connection (arg=arg@entry=0x436a720)
    at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/sql/conn_handler/connection_handler_per_thread.cc:300
#17 0x0000000001172850 in pfs_spawn_thread (arg=0x44581c0) at /export/home2/pb2/build/sb_0-16271286-1440606484.35/mysqlcom-pro-5.7.9/storage/perfschema/pfs.cc:2191
#18 0x00007f8caaa38df3 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f8ca94f947d in clone () from /lib64/libc.so.6
(gdb)
[28 Aug 2015 11:36] MySQL Verification Team
// 5.8.0 - release build is affected

bin/mysql_install_db  --insecure --basedir=/export/umesh/server/binaries/mysql-advanced-5.8.0 --datadir=/export/umesh/server/binaries/mysql-advanced-5.8.0/78260 -v
bin/mysqld --no-defaults --basedir=/export/umesh/server/binaries/mysql-advanced-5.8.0 --datadir=/export/umesh/server/binaries/mysql-advanced-5.8.0/78260 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/server/binaries/mysql-advanced-5.8.0/78260/log.err 2>&1 &

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.8.0: cat docs/INFO_SRC
commit: 60f15f33d5b04532c4e6d28e8133388fc512a0ff
date: 2015-08-26 16:49:48 +0200
build-date: 2015-08-26 17:01:08 +0200
short: 60f15f3
branch: mysql-trunk

MySQL source 5.8.0

(gdb) bt
#0  0x00007f9ce2604771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000008ac6d5 in handle_fatal_signal (sig=11) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/signal_handler.cc:221
#2  <signal handler called>
#3  0x0000000000794a53 in Partition_helper::ph_read_range_first (this=0x7f9c68023c30, start_key=0x7f9c68023a38, end_key=0x7f9c68023a58, eq_range_arg=<optimized out>, sorted=<optimized out>)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/partitioning/partition_handler.cc:2911
#4  0x0000000000932bd6 in handler::multi_range_read_next (this=0x7f9c68023950, range_info=0x7f9cb51936a0)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/handler.cc:6119
#5  0x0000000000d2588b in QUICK_RANGE_SELECT::get_next (this=0x7f9c6801d890) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/opt_range.cc:10991
#6  0x00000000007991ba in rr_quick (info=0x7f9c68931660) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/records.cc:399
#7  0x00000000007df61b in sub_select (join=0x7f9c68930f40, qep_tab=0x7f9c68931610, end_of_records=<optimized out>)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_executor.cc:1272
#8  0x00000000007d9207 in do_select (join=0x7f9c68930f40) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_executor.cc:952
#9  JOIN::exec (this=0x7f9c68930f40) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_executor.cc:214
#10 0x00000000008227ed in handle_query (thd=thd@entry=0x7f9c68000b50, lex=lex@entry=0x7f9c68002c18, result=0x7f9c68006e30, added_options=added_options@entry=0,
    removed_options=removed_options@entry=0) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_select.cc:190
#11 0x000000000074f92b in execute_sqlcom_select (thd=thd@entry=0x7f9c68000b50, all_tables=<optimized out>)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:4867
#12 0x00000000007f1cd6 in mysql_execute_command (thd=thd@entry=0x7f9c68000b50, first_level=first_level@entry=true)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:2560
#13 0x00000000007f5a65 in mysql_parse (thd=thd@entry=0x7f9c68000b50, parser_state=parser_state@entry=0x7f9cb51947b0)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:5274
#14 0x00000000007f63aa in dispatch_command (thd=thd@entry=0x7f9c68000b50, com_data=com_data@entry=0x7f9cb5194e00, command=COM_QUERY)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:1247
#15 0x00000000007f7b9f in do_command (thd=thd@entry=0x7f9c68000b50) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:815
#16 0x00000000008a24d8 in handle_connection (arg=arg@entry=0x33c5fd0)
    at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/sql/conn_handler/connection_handler_per_thread.cc:301
#17 0x000000000119dcb0 in pfs_spawn_thread (arg=0x3404a40) at /export/home2/pb2/build/sb_0-16270418-1440602177.1/mysqlcom-pro-5.8.0-m17/storage/perfschema/pfs.cc:2210
#18 0x00007f9ce25ffdf3 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f9ce10c047d in clone () from /lib64/libc.so.6
(gdb)
[28 Aug 2015 11:39] MySQL Verification Team
-- with 5.6.26 release build, got warnings(no crash)

mysql> SELECT * FROM t1 WHERE a BETWEEN '2000-01-01 01:02:00' AND '2000-01-01 01:03:00';
Empty set, 2 warnings (0.00 sec)

mysql> show warnings;
+---------+------+---------------------------------------------------------+
| Level   | Code | Message                                                 |
+---------+------+---------------------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: '2000-01-01 01:02:00' |
| Warning | 1292 | Truncated incorrect DOUBLE value: '2000-01-01 01:02:00' |
+---------+------+---------------------------------------------------------+
2 rows in set (0.00 sec)
[15 Sep 2015 15:29] Jon Stephens
Documented fix in the 5.7.10 changelog as follows:

    When all partitions were pruned, they were not initialized for
    scanning during initialization of indexes. This involved two
    related issues, one being that the active index was not set back
    to the maxmimum key value when the index was closed. In
    addition, when this occurred as part of a multi-range read,
    there were attempts to access unset variables.

Closed.
[18 Jun 2016 21:27] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0