Bug #77580 Assertion `t1->result_range' failed in sql/gcalc_tools.cc:731
Submitted: 1 Jul 2015 11:45 Modified: 2 Jul 2015 16:14
Reporter: Ramesh Sivaraman (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.23, 5.6.27 OS:CentOS (CentOS 7)
Assigned to: CPU Architecture:Any
Tags: debug

[1 Jul 2015 11:45] Ramesh Sivaraman
Description:
mysqld: /sda/mysql-server-5.6/sql/gcalc_tools.cc:731: int Gcalc_operation_reducer::end_couple(Gcalc_operation_reducer::active_thread*, Gcalc_operation_reduc
er::active_thread*, const Gcalc_heap::Info*): Assertion `t1->result_range' failed.
11:27:19 UTC - mysqld got signal 6 ;

** GDB info

#0  0x00007fa07ced3771 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000aba602 in my_write_core (sig=6) at /sda/mysql-server-5.6/mysys/stacktrace.c:422
#2  0x000000000072bec0 in handle_fatal_signal (sig=6) at /sda/mysql-server-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007fa07bcdf5d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fa07bce0cc8 in __GI_abort () at abort.c:90
#6  0x00007fa07bcd8546 in __assert_fail_base (fmt=0x7fa07be28128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xff29c4 "t1->result_range", file=file@entry=0xff2420 "/sda/mysql-server-5.6/sql/gcalc_tools.cc", line=line@entry=731, function=function@entry=0xff3180 <Gcalc_operation_reducer::end_couple(Gcalc_operation_reducer::active_thread*, Gcalc_operation_reducer::active_thread*, Gcalc_heap::Info const*)::__PRETTY_FUNCTION__> "int Gcalc_operation_reducer::end_couple(Gcalc_operation_reducer::active_thread*, Gcalc_operation_reducer::active_thread*, const Gcalc_heap::Info*)") at assert.c:92
#7  0x00007fa07bcd85f2 in __GI___assert_fail (assertion=0xff29c4 "t1->result_range", file=0xff2420 "/sda/mysql-server-5.6/sql/gcalc_tools.cc", line=731, function=0xff3180 <Gcalc_operation_reducer::end_couple(Gcalc_operation_reducer::active_thread*, Gcalc_operation_reducer::active_thread*, Gcalc_heap::Info const*)::__PRETTY_FUNCTION__> "int Gcalc_operation_reducer::end_couple(Gcalc_operation_reducer::active_thread*, Gcalc_operation_reducer::active_thread*, const Gcalc_heap::Info*)") at assert.c:101
#8  0x0000000000935361 in Gcalc_operation_reducer::end_couple (this=0x7fa05d41fac8, t0=0x7fa05d4ae480, t1=0x7fa05d4ae5e0, p=0x7fa05d4520b0) at /sda/mysql-server-5.6/sql/gcalc_tools.cc:731
#9  0x0000000000935dfd in Gcalc_operation_reducer::count_slice (this=0x7fa05d41fac8, si=0x7fa07d489290) at /sda/mysql-server-5.6/sql/gcalc_tools.cc:942
#10 0x0000000000936891 in Gcalc_operation_reducer::count_all (this=0x7fa05d41fac8, hp=0x7fa05d41f9b0) at /sda/mysql-server-5.6/sql/gcalc_tools.cc:1088
#11 0x00000000006c8f84 in Item_func_spatial_operation::val_str (this=0x7fa05d41f8e0, str_value=0x7fa07d489480) at /sda/mysql-server-5.6/sql/item_geofunc.cc:1060
#12 0x00000000006c5c68 in Item_func_as_wkt::val_str_ascii (this=0x7fa05d41fc50, str=0x7fa07d489640) at /sda/mysql-server-5.6/sql/item_geofunc.cc:146
#13 0x00000000006cfdbe in Item_str_func::val_str_from_val_str_ascii (this=0x7fa05d41fc50, str=0x7fa07d489640, str2=0x7fa05d41fd20) at /sda/mysql-server-5.6/sql/item_strfunc.cc:78
#14 0x000000000069c668 in Item_str_ascii_func::val_str (this=0x7fa05d41fc50, str=0x7fa07d489640) at /sda/mysql-server-5.6/sql/item_strfunc.h:81
#15 0x0000000000662251 in Item::send (this=0x7fa05d41fc50, protocol=0x7fa065be64d8, buffer=0x7fa07d489640) at /sda/mysql-server-5.6/sql/item.cc:6846
#16 0x0000000000723278 in Protocol::send_result_set_row (this=0x7fa065be64d8, row_items=0x7fa065be8998) at /sda/mysql-server-5.6/sql/protocol.cc:847
#17 0x00000000007931dd in select_send::send_data (this=0x7fa05d41fea8, items=...) at /sda/mysql-server-5.6/sql/sql_class.cc:2499
#18 0x00000000007a907a in JOIN::exec (this=0x7fa05d41fed0) at /sda/mysql-server-5.6/sql/sql_executor.cc:151
#19 0x000000000080bc93 in mysql_execute_select (thd=0x7fa065be6000, select_lex=0x7fa065be8878, free_join=true) at /sda/mysql-server-5.6/sql/sql_select.cc:1100
#20 0x000000000080bf8f in mysql_select (thd=0x7fa065be6000, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x7fa065be8a40, group=0x7fa065be8978, having=0x0, select_options=2147748608, result=0x7fa05d41fea8, unit=0x7fa065be8230, select_lex=0x7fa065be8878) at /sda/mysql-server-5.6/sql/sql_select.cc:1221
#21 0x000000000080a017 in handle_select (thd=0x7fa065be6000, result=0x7fa05d41fea8, setup_tables_done_option=0) at /sda/mysql-server-5.6/sql/sql_select.cc:110
#22 0x00000000007e2bd4 in execute_sqlcom_select (thd=0x7fa065be6000, all_tables=0x0) at /sda/mysql-server-5.6/sql/sql_parse.cc:5103
#23 0x00000000007db984 in mysql_execute_command (thd=0x7fa065be6000) at /sda/mysql-server-5.6/sql/sql_parse.cc:2649
#24 0x00000000007e579e in mysql_parse (thd=0x7fa065be6000, rawbuf=0x7fa05d41f010 "SELECT AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))))", length=190, parser_state=0x7fa07d48ae70) at /sda/mysql-server-5.6/sql/sql_parse.cc:6357
#25 0x00000000007d8910 in dispatch_command (command=COM_QUERY, thd=0x7fa065be6000, packet=0x7fa065bea001 "", packet_length=190) at /sda/mysql-server-5.6/sql/sql_parse.cc:1332
#26 0x00000000007d79ff in do_command (thd=0x7fa065be6000) at /sda/mysql-server-5.6/sql/sql_parse.cc:1034
#27 0x000000000079dfbd in do_handle_one_connection (thd_arg=0x7fa06c7ee000) at /sda/mysql-server-5.6/sql/sql_connect.cc:982
#28 0x000000000079daa6 in handle_one_connection (arg=0x7fa06c7ee000) at /sda/mysql-server-5.6/sql/sql_connect.cc:898
#29 0x0000000000b98604 in pfs_spawn_thread (arg=0x7fa07673e600) at /sda/mysql-server-5.6/storage/perfschema/pfs.cc:1860
#30 0x00007fa07cecedf5 in start_thread (arg=0x7fa07d48c700) at pthread_create.c:308
#31 0x00007fa07bda01ad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
** Testcase

SELECT AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));

$ vi {epoch}_mybase # Update base path in this file (the only change
required!). For non-binary distribution please update SOURCE_DIR
location also.
$ ./{epoch}_init # Initializes the data dir
$ ./{epoch}_start # Starts mysqld
$ ./{epoch}_cl # To check mysqld is up
$ ./{epoch}_run # Run the testcase with pquery binary(produces
output)
$ vi /dev/shm/{epoch}/error.log.out # Verify the error log
$ ./{epoch}_gdb # Brings you to a gdb prompt attached to correct
mysqld
& generated core
$ ./{epoch}_parse_core # Create {epoch}_STD.gdb and {epoch}_FULL.gdb;
standard and full var gdb stack traces
etc.
[1 Jul 2015 11:46] Ramesh Sivaraman
Testcase bundle

Attachment: 1435667557_bug_bundle.tar.gz (application/gzip, text), 1013.68 KiB.

[1 Jul 2015 12:13] Umesh Shastry
Hello Ramesh,

Thank you for the report and test case.
Observed that 5.6.27 debug build is affected.

Thanks,
Umesh
[1 Jul 2015 12:13] Umesh Shastry
// 5.6.27 

scripts/mysql_install_db --basedir=/export/umesh/server/binaries/mysql-5.6.27 --datadir=/export/umesh/server/binaries/mysql-5.6.27/bug
bin/mysqld --basedir=/export/umesh/server/binaries/mysql-5.6.27 --datadir=/export/umesh/server/binaries/mysql-5.6.27/bug --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/server/binaries/mysql-5.6.27/bug/log.err 2>&1 &

Build used:

[umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.27: cat docs/INFO_SRC
commit: 27523c60a37f521ff429302fbc2afd0e3f90dd05
date: 2015-06-30 10:30:04 +0530
build-date: 2015-06-30 07:15:40 +0200
short: 27523c6
branch: mysql-5.6

MySQL source 5.6.27

(gdb) bt
#0  0x00007ff8cebff771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000ae2e03 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/mysys/stacktrace.c:422
#2  0x0000000000746782 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007ff8cd8055c9 in raise () from /lib64/libc.so.6
#5  0x00007ff8cd806cd8 in abort () from /lib64/libc.so.6
#6  0x00007ff8cd7fe536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007ff8cd7fe5e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000959760 in Gcalc_operation_reducer::end_couple (this=0x7ff870005a80, t0=0x7ff870012f10, t1=0x7ff870013070, p=0x7ff87000eb60)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/gcalc_tools.cc:731
#9  0x000000000095a481 in Gcalc_operation_reducer::count_slice (this=0x7ff870005a80, si=0x7ff8a44971f0)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/gcalc_tools.cc:941
#10 0x000000000095af17 in Gcalc_operation_reducer::count_all (this=0x7ff870005a80, hp=0x7ff870005968)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/gcalc_tools.cc:1088
#11 0x00000000006e1f5a in Item_func_spatial_operation::val_str (this=0x7ff870005898, str_value=0x7ff8a4497440)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/item_geofunc.cc:1060
#12 0x00000000006e4750 in Item_func_as_wkt::val_str_ascii (this=0x7ff870005c08, str=0x7ff8a4497960)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/item_geofunc.cc:146
#13 0x00000000006ecc62 in Item_str_func::val_str_from_val_str_ascii (this=0x7ff870005c08, str=0x7ff8a4497960, str2=0x7ff870005cd8)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/item_strfunc.cc:78
#14 0x00000000006bc85c in Item_str_ascii_func::val_str (this=0x7ff870005c08, str=0x7ff8a4497960) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/item_strfunc.h:81
#15 0x0000000000663551 in Item::send (this=0x7ff870005c08, protocol=0x3d9efc8, buffer=0x7ff8a4497960) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/item.cc:6856
#16 0x000000000073d83c in Protocol::send_result_set_row (this=0x3d9efc8, row_items=0x3da10e0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/protocol.cc:847
#17 0x00000000007b10cb in select_send::send_data (this=0x7ff870005e60, items=...) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_class.cc:2530
#18 0x00000000007d18e0 in JOIN::exec (this=0x7ff870005e88) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_executor.cc:149
#19 0x00000000008347fa in mysql_execute_select (thd=0x3d9eaf0, select_lex=0x3da0fc0, free_join=true)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_select.cc:1100
#20 0x00000000008351b9 in mysql_select (thd=0x3d9eaf0, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x3da1188, group=0x3da10c0, having=0x0, select_options=2147748608,
    result=0x7ff870005e60, unit=0x3da0978, select_lex=0x3da0fc0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_select.cc:1221
#21 0x00000000008353b5 in handle_select (thd=0x3d9eaf0, result=0x7ff870005e60, setup_tables_done_option=0)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_select.cc:110
#22 0x00000000007fb14c in execute_sqlcom_select (thd=0x3d9eaf0, all_tables=0x0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_parse.cc:5134
#23 0x00000000007fc677 in mysql_execute_command (thd=0x3d9eaf0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_parse.cc:2656
#24 0x0000000000803c82 in mysql_parse (thd=0x3d9eaf0,
    rawbuf=0x7ff870004fd0 "SELECT AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))))", length=190, parser_state=0x7ff8a4499700) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_parse.cc:6386
#25 0x00000000008058a6 in dispatch_command (command=COM_QUERY, thd=0x3d9eaf0, packet=0x3ece211 "", packet_length=190)
    at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_parse.cc:1340
#26 0x0000000000807132 in do_command (thd=0x3d9eaf0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_parse.cc:1037
#27 0x00000000007bbd81 in do_handle_one_connection (thd_arg=0x3d9eaf0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_connect.cc:982
#28 0x00000000007bbe47 in handle_one_connection (arg=0x3d9eaf0) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/sql/sql_connect.cc:898
#29 0x0000000000db0108 in pfs_spawn_thread (arg=0x3e46a40) at /export/home/pb2/build/sb_0-15730337-1435642741.03/mysqlcom-pro-5.6.27/storage/perfschema/pfs.cc:1860
#30 0x00007ff8cebfadf3 in start_thread () from /lib64/libpthread.so.0
#31 0x00007ff8cd8c647d in clone () from /lib64/libc.so.6
(gdb)
[1 Jul 2015 12:19] Umesh Shastry
// 5.7.8(debug/release) seems to be not affected

mysql>
mysql> SELECT AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)')))) |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GEOMETRYCOLLECTION(POLYGON((0 0,7 0,7 9,0 9,0 0)),MULTILINESTRING((7 5.285714285714286,8 5,7 8),(7 7,9 9,9 0,8 4,9 9)))                                                                 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 4 warnings (0.01 sec)

mysql>
[1 Jul 2015 13:24] Norvald Ryeng
Posted by developer:
 
This was fixed in MySQL 5.7.7. I'm closing this bug report.
[2 Jul 2015 16:14] Paul Dubois
Noted in 5.7.7 changelog.

For debug builds, an assertion was raised when calculating the
symmetric difference between a MultiLineString and a MultiPoint.