Bug #74856 handle_fatal_signal (sig=6) in get_parts_for_update | sql/sql_partition.cc:328
Submitted: 14 Nov 2014 9:03 Modified: 25 Nov 2019 21:23
Reporter: Ramesh Sivaraman Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.21-debug, 5.6.23, 5.7.6 OS:Linux (CentOS 7)
Assigned to: CPU Architecture:Any

[14 Nov 2014 9:03] Ramesh Sivaraman
Description:
mysqld: /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_partition.cc:328: int get_parts_for_update(const uchar*, uchar*, const uchar*, partition_info*, uint32*, 
uint32*, longlong*): Assertion `0' failed.
08:51:47 UTC - mysqld got signal 6 ;

** GDB info

#0  0x00007f478901c771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a954ea in my_write_core (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000726494 in handle_fatal_signal (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007f4787e285c9 in raise () from /lib64/libc.so.6
#5  0x00007f4787e29cd8 in abort () from /lib64/libc.so.6
#6  0x00007f4787e21536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f4787e215e2 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000009bc6b1 in get_parts_for_update (old_data=0x7f46e40986f8 <incomplete sequence \375>, new_data=0x7f46e40986f0 "\375\002", rec0=0x7f46e40986f0 "\375\002", part_info=0x7f46e402c010, old_part_id=0x7f47895d07a8, new_part_id=0x7f47895d07ac, new_func_value=0x7f47895d07a0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_partition.cc:328
#9  0x0000000000e10373 in ha_partition::update_row (this=0x7f46e40a7010, old_data=0x7f46e40986f8 <incomplete sequence \375>, new_data=0x7f46e40986f0 "\375\002") at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:4022
#10 0x0000000000644c57 in handler::ha_update_row (this=0x7f46e40a7010, old_data=0x7f46e40986f8 <incomplete sequence \375>, new_data=0x7f46e40986f0 "\375\002") at /ssd/ramesh/mysql-server/mysql-5.6/sql/handler.cc:7305
#11 0x00000000008620a6 in mysql_update (thd=0x7f46f5b5d000, table_list=0x7f46e401f0e8, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f47895d19f8, updated_return=0x7f47895d19f0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_update.cc:818
#12 0x00000000007d3e6a in mysql_execute_command (thd=0x7f46f5b5d000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:3307
#13 0x00000000007dbdbc in mysql_parse (thd=0x7f46f5b5d000, rawbuf=0x7f46e401f010 "UPDATE t1 SET c1=2", length=18, parser_state=0x7f47895d1e70) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:6245
#14 0x00000000007cf36f in dispatch_command (command=COM_QUERY, thd=0x7f46f5b5d000, packet=0x7f46ea666001 "UPDATE t1 SET c1=2", packet_length=18) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1332
#15 0x00000000007ce45e in do_command (thd=0x7f46f5b5d000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1034
#16 0x0000000000796879 in do_handle_one_connection (thd_arg=0x7f46f5b5d000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:982
#17 0x0000000000796362 in handle_one_connection (arg=0x7f46f5b5d000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:898
#18 0x0000000000d71288 in pfs_spawn_thread (arg=0x7f47853fea60) at /ssd/ramesh/mysql-server/mysql-5.6/storage/perfschema/pfs.cc:1860
#19 0x00007f4789017df3 in start_thread () from /lib64/libpthread.so.0
#20 0x00007f4787ee901d in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(c1 INT)PARTITION BY LIST(1 DIV c1) (PARTITION p0 VALUES IN (NULL),PARTITION p1 VALUES IN (1));
insert into t1 values(repeat(0x00002021,0));
set sql_mode=traditional;
CREATE TEMPORARY TABLE t1(c1 TEXT);
DROP TABLES t1,t2,t3;
UPDATE t1 SET c1=2;
[14 Nov 2014 11:17] MySQL Verification Team
Hello Ramesh Sivaraman,

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:18] MySQL Verification Team
// 5.6.23

(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=6) 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=6) 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  0x0000003deac32625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x0000003deac33e05 in abort () at abort.c:92
#6  0x0000003deac2b74e in __assert_fail_base (fmt=<value optimized out>, assertion=0x10c6886 "0",
    file=0x10c67a8 "/export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_partition.cc", line=<value optimized out>, function=<value optimized out>) at assert.c:96
#7  0x0000003deac2b810 in __assert_fail (assertion=0x10c6886 "0", file=0x10c67a8 "/export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_partition.cc", line=328,
    function=0x10c8f40 "int get_parts_for_update(const uchar*, uchar*, const uchar*, partition_info*, uint32*, uint32*, longlong*)") at assert.c:105
#8  0x0000000000a23672 in get_parts_for_update (old_data=0x7f7a60041a28  <incomplete sequence \375>, new_data=0x7f7a60041a20 "\375\002", rec0=0x7f7a60041a20 "\375\002",
    part_info=0x7f7a6000fa30, old_part_id=0x7f7a8f5bd958, new_part_id=0x7f7a8f5bd95c, new_func_value=0x7f7a8f5bd950)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_partition.cc:328
#9  0x0000000000e8460a in ha_partition::update_row (this=0x7f7a6003dc80, old_data=0x7f7a60041a28  <incomplete sequence \375>, new_data=0x7f7a60041a20 "\375\002")
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/ha_partition.cc:4057
#10 0x0000000000699cdc in handler::ha_update_row (this=0x7f7a6003dc80, old_data=0x7f7a60041a28  <incomplete sequence \375>, new_data=0x7f7a60041a20 "\375\002")
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/handler.cc:7305
#11 0x00000000008c0a06 in mysql_update (thd=0x3ced270, table_list=0x7f7a60006e58, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615,
    handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f7a8f5bed08, updated_return=0x7f7a8f5bed00)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_update.cc:818
#12 0x000000000082f736 in mysql_execute_command (thd=0x3ced270) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:3307
#13 0x0000000000837fa9 in mysql_parse (thd=0x3ced270, rawbuf=0x7f7a60006d80 "UPDATE t1 SET c1=2", length=18, parser_state=0x7f7a8f5bf680)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:6357
#14 0x000000000082a92b in dispatch_command (command=COM_QUERY, thd=0x3ced270, packet=0x3e1baa1 "UPDATE t1 SET c1=2", packet_length=18)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1332
#15 0x0000000000829990 in do_command (thd=0x3ced270) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1034
#16 0x00000000007f0d8f in do_handle_one_connection (thd_arg=0x3ced270) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:982
#17 0x00000000007f0860 in handle_one_connection (arg=0x3ced270) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:898
#18 0x0000000000e5f509 in pfs_spawn_thread (arg=0x3ddf1d0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/storage/perfschema/pfs.cc:1860
#19 0x0000003deb0079d1 in start_thread (arg=0x7f7a8f5c0700) at pthread_create.c:301
#20 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

 
// 5.7.6

(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=6) 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=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x0000003deac32625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x0000003deac33e05 in abort () at abort.c:92
#6  0x0000003deac2b74e in __assert_fail_base (fmt=<value optimized out>, assertion=0x1690516 "0",
    file=0x1690440 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_partition.cc", line=<value optimized out>, function=<value optimized out>) at assert.c:96
#7  0x0000003deac2b810 in __assert_fail (assertion=0x1690516 "0", file=0x1690440 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_partition.cc", line=327,
    function=0x1692cc0 "int get_parts_for_update(const uchar*, uchar*, const uchar*, partition_info*, uint32*, uint32*, longlong*)") at assert.c:105
#8  0x0000000000ea5fc1 in get_parts_for_update (old_data=0x7eff640403b0  <incomplete sequence \375>, new_data=0x7eff640403a8 "\375\002", rec0=0x7eff640403a8 "\375\002",
    part_info=0x7eff6401a630, old_part_id=0x7effa8a53488, new_part_id=0x7effa8a5348c, new_func_value=0x7effa8a53480)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_partition.cc:327
#9  0x00000000013eeae0 in ha_partition::update_row (this=0x7eff64045360, old_data=0x7eff640403b0  <incomplete sequence \375>, new_data=0x7eff640403a8 "\375\002")
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/ha_partition.cc:4105
#10 0x000000000099f5e0 in handler::ha_update_row (this=0x7eff64045360, old_data=0x7eff640403b0  <incomplete sequence \375>, new_data=0x7eff640403a8 "\375\002")
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/handler.cc:7475
#11 0x0000000000d53dcc in mysql_update (thd=0x7eff64000d30, fields=..., values=..., limit=18446744073709551615, handle_duplicates=DUP_ERROR, found_return=0x7effa8a54c88,
    updated_return=0x7effa8a54c80) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_update.cc:873
#12 0x0000000000cb5f1e in mysql_execute_command (thd=0x7eff64000d30) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:3165
#13 0x0000000000cbce6a in mysql_parse (thd=0x7eff64000d30, parser_state=0x7effa8a55660) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:5397
#14 0x0000000000cb0f2c in dispatch_command (command=COM_QUERY, thd=0x7eff64000d30, packet=0x7eff64009a61 "UPDATE t1 SET c1=2", packet_length=18)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:1249
#15 0x0000000000cafbd4 in do_command (thd=0x7eff64000d30) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:833
#16 0x0000000000dbe89c in handle_connection (arg=0x336e650) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#17 0x000000000138347f in pfs_spawn_thread (arg=0x31c4a90) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/perfschema/pfs.cc:2137
#18 0x0000003deb0079d1 in start_thread (arg=0x7effa8a56700) at pthread_create.c:301
#19 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

[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
[14 Nov 2014 11:18] MySQL Verification Team
// 5.5.42 build not affected
[19 Nov 2014 22:42] Mattias Jonsson
The assert could be removed which would return an error instead (as it does in non-debug builds).

The reason is because sql_mode ERROR_FOR_DIVISION_BY_ZERO is set (part of TRADITIONAL) which will produce an warning when looking up which partition to update.

Another way to fix it would be to rely on that the partition to update is the same as the partition which was last read (partition for the new value still needs to be looked up).
[25 Nov 2019 21:23] Roy Lyseng
Posted by developer:
 
Not reproducible in 5.7.