Bug #90550 [MySQL 8.0 GA Debug Build] Assertion `data_type() == MYSQL_TYPE_GEOMETRY' failed
Submitted: 21 Apr 2018 3:42 Modified: 25 Apr 2018 20:32
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S1 (Critical)
Version:8.0.11 GA OS:Any
Assigned to: CPU Architecture:Any
Tags: debug build

[21 Apr 2018 3:42] Roel Van de Paar
Description:
mysqld: /git/mysql-server_dbg/sql/item.h:3272: virtual Field::geometry_type Item_field::get_geometry_type() const: Assertion `data_type() == MYSQL_TYPE_GEOMETRY' failed.
03:39:38 UTC - mysqld got signal 6 ;

(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x00005596a42634a5 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.cc:278
#2  0x00005596a2fea18c in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f95068bd801 in __GI_abort () at abort.c:79
#6  0x00007f95068ad39a in __assert_fail_base (fmt=0x7f9506a347d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x5596a536b1b0 "data_type() == MYSQL_TYPE_GEOMETRY", file=file@entry=0x5596a536b0f8 "/git/mysql-server_dbg/sql/item.h", 
    line=line@entry=3272, 
    function=function@entry=0x5596a5370180 <Item_field::get_geometry_type() const::__PRETTY_FUNCTION__> "virtual Field::geometry_type Item_field::get_geometry_type() const") at assert.c:92
#7  0x00007f95068ad412 in __GI___assert_fail (assertion=0x5596a536b1b0 "data_type() == MYSQL_TYPE_GEOMETRY", 
    file=0x5596a536b0f8 "/git/mysql-server_dbg/sql/item.h", line=3272, 
    function=0x5596a5370180 <Item_field::get_geometry_type() const::__PRETTY_FUNCTION__> "virtual Field::geometry_type Item_field::get_geometry_type() const")
    at assert.c:101
#8  0x00005596a31ddf52 in Item_field::get_geometry_type (this=0x7f94d92dc9f0) at /git/mysql-server_dbg/sql/item.h:3272
#9  0x00005596a31dbb57 in Item_type_holder::join_types (this=0x7f94d92dc7e8, item=0x7f94d92dc9f0) at /git/mysql-server_dbg/sql/item.cc:9028
#10 0x00005596a2f38bbf in SELECT_LEX_UNIT::prepare (this=0x7f94d907a3b0, thd_arg=0x7f94d9023000, sel_result=0x7f94d92dc578, added_options=268435456, 
    removed_options=0) at /git/mysql-server_dbg/sql/sql_union.cc:633
#11 0x00005596a2ea7bad in handle_query (thd=0x7f94d9023000, lex=0x7f94d9028800, result=0x7f94d92dc578, added_options=268435456, removed_options=0)
    at /git/mysql-server_dbg/sql/sql_select.cc:169
#12 0x00005596a33c22ab in Sql_cmd_create_table::execute (this=0x7f94d907d7b0, thd=0x7f94d9023000) at /git/mysql-server_dbg/sql/sql_cmd_ddl_table.cc:298
#13 0x00005596a2e48107 in mysql_execute_command (thd=0x7f94d9023000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:3216
#14 0x00005596a2e4dbb2 in mysql_parse (thd=0x7f94d9023000, parser_state=0x7f950687b330) at /git/mysql-server_dbg/sql/sql_parse.cc:4935
#15 0x00005596a2e43713 in dispatch_command (thd=0x7f94d9023000, com_data=0x7f950687bc90, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1589
#16 0x00005596a2e41fee in do_command (thd=0x7f94d9023000) at /git/mysql-server_dbg/sql/sql_parse.cc:1214
#17 0x00005596a2fd7a70 in handle_connection (arg=0x7f94bb46e420) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#18 0x00005596a48f7cf8 in pfs_spawn_thread (arg=0x7f94fa7e7720) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2814
#19 0x00007f95082a76db in start_thread (arg=0x7f950687c700) at pthread_create.c:463
#20 0x00007f950699e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
DROP DATABASE test; CREATE DATABASE test; USE test;
CREATE TABLE t1(a LINESTRING NOT NULL,b GEOMETRY NOT NULL,SPATIAL KEY(a))ENGINE=InnoDB;
CREATE TABLE t2 SELECT a FROM t1 UNION SELECT * FROM(SELECT NULL)a;
[21 Apr 2018 3:42] Roel Van de Paar
Updated title
[21 Apr 2018 3:55] MySQL Verification Team
Thank you for the bug report.

miguel@tikal:~/dbsd $ ./80c
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.12-debug Source distribution 2018-APR-18

Copyright (c) 2000, 2018, 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 8.0 > DROP DATABASE test; CREATE DATABASE test; USE test;
Query OK, 0 rows affected (0,19 sec)

Query OK, 1 row affected (0,20 sec)

Database changed
mysql 8.0 > CREATE TABLE t1(a LINESTRING NOT NULL,b GEOMETRY NOT NULL,SPATIAL KEY(a))ENGINE=InnoDB;
Query OK, 0 rows affected, 1 warning (0,64 sec)

mysql 8.0 > CREATE TABLE t2 SELECT a FROM t1 UNION SELECT * FROM(SELECT NULL)a;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql 8.0 >
[21 Apr 2018 3:56] MySQL Verification Team
2018-04-21T03:32:49.431743Z 0 [System] [MY-010116] [Server] /home/miguel/dbsd/8.0/bin/mysqld (mysqld 8.0.12-debug) starting as process 3463
2018-04-21T03:32:51.906612Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-04-21T03:32:52.079100Z 0 [System] [MY-010931] [Server] /home/miguel/dbsd/8.0/bin/mysqld: ready for connections. Version: '8.0.12-debug'  socket: '/tmp/mysql80.sock'  port: 3380  Source distribution 2018-APR-18.
mysqld: /home/miguel/buildd/2018APR18/mysql-8.0/sql/item.h:3279: virtual Field::geometry_type Item_field::get_geometry_type() const: Assertion `data_type() == MYSQL_TYPE_GEOMETRY' failed.
03:53:54 UTC - mysqld got signal 6 ;
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.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

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

Thread pointer: 0x7f29d80c2f80
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...
stack_bottom = 7f2a882b3d38 thread_stack 0x46000
/home/miguel/dbsd/8.0/bin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x55) [0x411be4d]
/home/miguel/dbsd/8.0/bin/mysqld(handle_fatal_signal+0x424) [0x2e53f77]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2a9d972390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f2a9c070428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f2a9c07202a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7) [0x7f2a9c068bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82) [0x7f2a9c068c82]
/home/miguel/dbsd/8.0/bin/mysqld(Item_field::get_geometry_type() const+0x3e) [0x30528cc]
/home/miguel/dbsd/8.0/bin/mysqld(Item_type_holder::join_types(THD*, Item*)+0x237) [0x30504bf]
/home/miguel/dbsd/8.0/bin/mysqld(SELECT_LEX_UNIT::prepare(THD*, Query_result*, unsigned long long, unsigned long long)+0x860) [0x2da128c]
/home/miguel/dbsd/8.0/bin/mysqld(handle_query(THD*, LEX*, Query_result*, unsigned long long, unsigned long long)+0x24a) [0x2d0ac88]
/home/miguel/dbsd/8.0/bin/mysqld(Sql_cmd_create_table::execute(THD*)+0x9f1) [0x323d80b]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_execute_command(THD*, bool)+0x22eb) [0x2caa18d]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_parse(THD*, Parser_state*)+0x65e) [0x2cafbd0]
/home/miguel/dbsd/8.0/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x13a7) [0x2ca570c]
/home/miguel/dbsd/8.0/bin/mysqld(do_command(THD*)+0x484) [0x2ca3fc5]
/home/miguel/dbsd/8.0/bin/mysqld() [0x2e4174b]
/home/miguel/dbsd/8.0/bin/mysqld() [0x47eef1a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f2a9d9686ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f2a9c14241d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f29d82e41d8): CREATE TABLE t2 SELECT a FROM t1 UNION SELECT * FROM(SELECT NULL)a
Connection ID (thread ID): 10
Status: NOT_KILLED
[25 Apr 2018 20:32] Paul DuBois
Posted by developer:
 
Fixed in 8.0.12.

For debug builds, an assertion could be raised for UNION queries when
computing the combined data type of a GEOMETRY column and SELECT *
FROM (SELECT NULL).