Bug #83737 Assertion `t1->result_range' failed.
Submitted: 8 Nov 2016 9:10 Modified: 7 Dec 2017 4:07
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S1 (Critical)
Version:5.6.34,5.6.38 OS:Any
Assigned to: CPU Architecture:Any

[8 Nov 2016 9:10] Roel Van de Paar
Description:
Ref bug 75946

+bt
#0  0x00007f3579273741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000a9c852 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:422
#2  0x000000000072c554 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007f35778125f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f3577813ce8 in __GI_abort () at abort.c:90
#6  0x00007f357780b566 in __assert_fail_base (fmt=0x7f357795bce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xf100e4 "t1->result_range", file=file@entry=0xf0fb40 "/git/mysql-server_dbg/sql/gcalc_tools.cc", line=line@entry=731, function=function@entry=0xf108a0 <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  0x00007f357780b612 in __GI___assert_fail (assertion=0xf100e4 "t1->result_range", file=0xf0fb40 "/git/mysql-server_dbg/sql/gcalc_tools.cc", line=731, function=0xf108a0 <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  0x000000000092b669 in Gcalc_operation_reducer::end_couple (this=0x7f3543c1fac8, t0=0x7f3543c77480, t1=0x7f3543c775e0, p=0x7f3543c730b0) at /git/mysql-server_dbg/sql/gcalc_tools.cc:731
#9  0x000000000092c0d3 in Gcalc_operation_reducer::count_slice (this=0x7f3543c1fac8, si=0x7f35798659a0) at /git/mysql-server_dbg/sql/gcalc_tools.cc:942
#10 0x000000000092cb5d in Gcalc_operation_reducer::count_all (this=0x7f3543c1fac8, hp=0x7f3543c1f9b0) at /git/mysql-server_dbg/sql/gcalc_tools.cc:1088
#11 0x00000000006cc508 in Item_func_spatial_operation::val_str (this=0x7f3543c1f8e0, str_value=0x7f3579865b90) at /git/mysql-server_dbg/sql/item_geofunc.cc:1060
#12 0x00000000006c9220 in Item_func_as_wkt::val_str_ascii (this=0x7f3543c1fc50, str=0x7f3579865d50) at /git/mysql-server_dbg/sql/item_geofunc.cc:146
#13 0x00000000006d3034 in Item_str_func::val_str_from_val_str_ascii (this=0x7f3543c1fc50, str=0x7f3579865d50, str2=0x7f3543c1fd20) at /git/mysql-server_dbg/sql/item_strfunc.cc:78
#14 0x00000000006a02aa in Item_str_ascii_func::val_str (this=0x7f3543c1fc50, str=0x7f3579865d50) at /git/mysql-server_dbg/sql/item_strfunc.h:81
#15 0x00000000006665df in Item::send (this=0x7f3543c1fc50, protocol=0x7f35507874d8, buffer=0x7f3579865d50) at /git/mysql-server_dbg/sql/item.cc:6898
#16 0x00000000007243b4 in Protocol::send_result_set_row (this=0x7f35507874d8, row_items=0x7f35507895f0) at /git/mysql-server_dbg/sql/protocol.cc:844
#17 0x0000000000791e53 in select_send::send_data (this=0x7f3543c1fea8, items=...) at /git/mysql-server_dbg/sql/sql_class.cc:2538
#18 0x00000000007a7832 in JOIN::exec (this=0x7f3543c1fed0) at /git/mysql-server_dbg/sql/sql_executor.cc:151
#19 0x0000000000807d4d in mysql_execute_select (thd=0x7f3550787000, select_lex=0x7f35507894d0, free_join=true) at /git/mysql-server_dbg/sql/sql_select.cc:1101
#20 0x000000000080803f in mysql_select (thd=0x7f3550787000, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x7f3550789698, group=0x7f35507895d0, having=0x0, select_options=2147748608, result=0x7f3543c1fea8, unit=0x7f3550788e88, select_lex=0x7f35507894d0) at /git/mysql-server_dbg/sql/sql_select.cc:1222
#21 0x0000000000806127 in handle_select (thd=0x7f3550787000, result=0x7f3543c1fea8, setup_tables_done_option=0) at /git/mysql-server_dbg/sql/sql_select.cc:110
#22 0x00000000007e020e in execute_sqlcom_select (thd=0x7f3550787000, all_tables=0x0) at /git/mysql-server_dbg/sql/sql_parse.cc:5133
#23 0x00000000007d9019 in mysql_execute_command (thd=0x7f3550787000) at /git/mysql-server_dbg/sql/sql_parse.cc:2655
#24 0x00000000007e2d7e in mysql_parse (thd=0x7f3550787000, rawbuf=0x7f3543c1f010 "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=0x7f35798675a0) at /git/mysql-server_dbg/sql/sql_parse.cc:6385
#25 0x00000000007d5faf in dispatch_command (command=COM_QUERY, thd=0x7f3550787000, packet=0x7f355076b001 "", packet_length=190) at /git/mysql-server_dbg/sql/sql_parse.cc:1339
#26 0x00000000007d5016 in do_command (thd=0x7f3550787000) at /git/mysql-server_dbg/sql/sql_parse.cc:1036
#27 0x000000000079c9a5 in do_handle_one_connection (thd_arg=0x7f3550787000) at /git/mysql-server_dbg/sql/sql_connect.cc:982
#28 0x000000000079c48e in handle_one_connection (arg=0x7f3550787000) at /git/mysql-server_dbg/sql/sql_connect.cc:898
#29 0x0000000000ae8ac9 in pfs_spawn_thread (arg=0x7f355c3896a0) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:1860
#30 0x00007f357926edc5 in start_thread (arg=0x7f3579868700) at pthread_create.c:308
#31 0x00007f35778d3ced in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
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)'))));
[8 Nov 2016 9:18] MySQL Verification Team
Thank you for the bug report. I always to repeat with debug server same for you?. Thanks.

c:\dbs>c:\dbs\5.6\bin\mysql -uroot --port=3560 -p --prompt="mysql 5.6 > "
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.36 Source distribution PULL: 2016-NOV-05

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 5.6 > 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)'))))\G
*************************** 1. row ***************************
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(LINESTRING(9 9,8 4,9 0,9 9),POINT(9 9),POLYGON((0 0,0 9,7 9,7 0,0 0)),LINESTRING(6 3,3 4,1 1,9 9),LINESTRING(7 5.285714285714286,8 5,7 8,7 7),POINT(7 8))
1 row in set (0.00 sec)

mysql 5.6 > exit
Bye

c:\dbs>56q

c:\dbs>c:\dbs\5.6\bin\mysqladmin -uroot --port=3560 -p shutdown
Enter password:

c:\dbs>56c

c:\dbs>c:\dbs\5.6\bin\mysql -uroot --port=3560 -p --prompt="mysql 5.6 > "
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.36-debug Source distribution PULL: 2016-NOV-05

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 5.6 > 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)'))))\G
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql 5.6 >
[8 Nov 2016 9:25] MySQL Verification Team
2016-11-08 07:15:39 256 [Note] c:\dbs\5.6\bin\mysqld: ready for connections.
Version: '5.6.36-debug'  socket: ''  port: 3560  Source distribution PULL: 2016-NOV-05
Assertion failed: t1->result_range, file C:\build\2016NOV05\mysql-5.6\sql\gcalc_tools.cc, line 731
R6010
- abort() has been called
09:15:55 UTC - mysqld got exception 0x80000003 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 67958 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x1cbde14e330
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
7ff632d6ea45    mysqld.exe!my_sigabrt_handler()[my_thr_init.c:455]
7ff633351e1f    mysqld.exe!raise()[winsig.c:594]
7ff633353d50    mysqld.exe!abort()[abort.c:82]
7ff63334e698    mysqld.exe!_wassert()[assert.c:156]
7ff632ae45d5    mysqld.exe!Gcalc_operation_reducer::end_couple()[gcalc_tools.cc:731]
7ff632ae30db    mysqld.exe!Gcalc_operation_reducer::count_slice()[gcalc_tools.cc:942]
7ff632ae3c4e    mysqld.exe!Gcalc_operation_reducer::count_all()[gcalc_tools.cc:1088]
7ff632afc7c3    mysqld.exe!Item_func_spatial_operation::val_str()[item_geofunc.cc:1061]
7ff632af8e04    mysqld.exe!Item_func_as_wkt::val_str_ascii()[item_geofunc.cc:146]
7ff632930b00    mysqld.exe!Item_str_func::val_str_from_val_str_ascii()[item_strfunc.cc:78]
7ff63296e2f0    mysqld.exe!Item_str_ascii_func::val_str()[item_strfunc.h:82]
7ff6328dee43    mysqld.exe!Item::send()[item.cc:6898]
7ff6328c4632    mysqld.exe!Protocol::send_result_set_row()[protocol.cc:844]
7ff6328d34dd    mysqld.exe!select_send::send_data()[sql_class.cc:2543]
7ff632c3350e    mysqld.exe!JOIN::exec()[sql_executor.cc:151]
7ff632bb4b1e    mysqld.exe!mysql_execute_select()[sql_select.cc:1104]
7ff632ba7959    mysqld.exe!mysql_select()[sql_select.cc:1222]
7ff632ba756d    mysqld.exe!handle_select()[sql_select.cc:110]
7ff6329b5b73    mysqld.exe!execute_sqlcom_select()[sql_parse.cc:5164]
7ff6329a7525    mysqld.exe!mysql_execute_command()[sql_parse.cc:2686]
7ff6329a5fba    mysqld.exe!mysql_parse()[sql_parse.cc:6416]
7ff6329af6a9    mysqld.exe!dispatch_command()[sql_parse.cc:1372]
7ff6329ae6c5    mysqld.exe!do_command()[sql_parse.cc:1036]
7ff6329fffe2    mysqld.exe!do_handle_one_connection()[sql_connect.cc:982]
7ff6329ffe12    mysqld.exe!handle_one_connection()[sql_connect.cc:900]
7ff63322a2e5    mysqld.exe!pfs_spawn_thread()[pfs.cc:1862]
7ff632d6d016    mysqld.exe!pthread_start()[my_winthread.c:62]
7ff633362395    mysqld.exe!_callthreadstartex()[threadex.c:376]
7ff6333625e7    mysqld.exe!_threadstartex()[threadex.c:359]
7ffc71858364    KERNEL32.DLL!BaseThreadInitThunk()
7ffc71f85e91    ntdll.dll!RtlUserThreadStart()
[8 Nov 2016 10:13] MySQL Verification Team
Thank you for the bug report.
[15 Nov 2017 18:01] Erlend Dahl
Can't repeat on recent 5.7/8.0. There are no plans to backport a fix.
[16 Nov 2017 8:04] Roel Van de Paar
Note that 8.0.3 requires a syntax update

https://dev.mysql.com/doc/refman/8.0/en/gis-format-conversion-functions.html#function_aste...

8.0.3>SELECT ST_AsText(ST_SYMDIFFERENCE(ST_MultiLineStringFromText('ST_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))'),ST_Envelope(ST_GeometryFromText('ST_MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));
ERROR 3037 (22023): Invalid GIS data provided to function st_multilinestringfromtext.
[16 Nov 2017 8:07] Roel Van de Paar
5.7.19 and 8.0.3 react differently, and 5.7.19 reacts differently when using older or newer functions

5.7.19>SELECT ST_AsText(ST_SYMDIFFERENCE(ST_MultiLineStringFromText('ST_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))'),ST_Envelope(ST_GeometryFromText('ST_MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));
ERROR 3037 (22023): Invalid GIS data provided to function st_geometryfromtext.
5.7.19>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)

5.7.19>show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                        |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'ASTEXT' is deprecated and will be removed in a future release. Please use ST_ASTEXT instead                                   |
| Warning | 1287 | 'MULTILINESTRINGFROMTEXT' is deprecated and will be removed in a future release. Please use ST_MULTILINESTRINGFROMTEXT instead |
| Warning | 1287 | 'ENVELOPE' is deprecated and will be removed in a future release. Please use ST_ENVELOPE instead                               |
| Warning | 1287 | 'GEOMETRYFROMTEXT' is deprecated and will be removed in a future release. Please use ST_GEOMETRYFROMTEXT instead               |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.01 sec)
[16 Nov 2017 8:10] Roel Van de Paar
Logged bug 88513
[7 Dec 2017 4:06] Roel Van de Paar
See bug 88801
[7 Dec 2017 4:07] Roel Van de Paar
This bug still crashes 5.6.38

5.6.38>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)'))));
ERROR 2013 (HY000): Lost connection to MySQL server during query
[7 Dec 2017 4:07] Roel Van de Paar
Please fix