Bug #92170 field.h:912: virtual longlong Field::val_time_temporal(): Assertion `0' failed.
Submitted: 24 Aug 2018 4:08 Modified: 24 Aug 2018 5:27
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[24 Aug 2018 4:08] Roel Van de Paar
Description:
This bug seems only present in 8.0.11, not 8.0.12. However, as it did not seem logged yet, I am logging it for completeness. Please check against 8.0.13 and internal bug db. Thanks

mysqld: /git/mysql-server_dbg/sql/field.h:912: virtual longlong Field::val_time_temporal(): Assertion `0' failed.
04:05:35 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS200418-mysql-8.0.11-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7fd2b1e6b700 (LWP 9172))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055914720f4a5 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.cc:278
#2  0x0000559145f9618c 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  0x00007fd2b1eac801 in __GI_abort () at abort.c:79
#6  0x00007fd2b1e9c39a in __assert_fail_base (fmt=0x7fd2b20237d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x5591482fad39 "0", file=file@entry=0x5591482facf0 "/git/mysql-server_dbg/sql/field.h", 
    line=line@entry=912, 
    function=function@entry=0x559148301580 <Field::val_time_temporal()::__PRETTY_FUNCTION__> "virtual longlong Field::val_time_temporal()") at assert.c:92
#7  0x00007fd2b1e9c412 in __GI___assert_fail (assertion=0x5591482fad39 "0", 
    file=0x5591482facf0 "/git/mysql-server_dbg/sql/field.h", line=912, 
    function=0x559148301580 <Field::val_time_temporal()::__PRETTY_FUNCTION__> "virtual longlong Field::val_time_temporal()")
    at assert.c:101
#8  0x00005591460e92b3 in Field::val_time_temporal (this=0x7fd291b9f708) at /git/mysql-server_dbg/sql/field.h:912
#9  0x0000559146170d53 in Item_field::val_time_temporal (this=0x7fd266c9c300) at /git/mysql-server_dbg/sql/item.cc:2605
#10 0x0000559146193eaf in get_time_value (item_arg=0x7fd2b1e68918, cache_arg=0x0, is_null=0x7fd2b1e68916)
    at /git/mysql-server_dbg/sql/item_cmpfunc.cc:992
#11 0x00005591461a0aae in cmp_item_datetime::cmp (this=0x7fd266c9ca80, arg=0x7fd266c9c300)
    at /git/mysql-server_dbg/sql/item_cmpfunc.cc:4197
#12 0x00005591461a2d2b in Item_func_in::val_int (this=0x7fd266d74250) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:4759
#13 0x000055914616817d in Item::val_bool (this=0x7fd266d74250) at /git/mysql-server_dbg/sql/item.cc:201
#14 0x00005591461a4424 in Item_cond_and::val_int (this=0x7fd266d303c8) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:5120
#15 0x0000559145d8f349 in QEP_TAB::skip_record (this=0x7fd266d30790, thd=0x7fd291b0f000, skip_record_arg=0x7fd2b1e68ac6)
    at /git/mysql-server_dbg/sql/sql_executor.h:505
#16 0x000055914638cd75 in JOIN_CACHE::check_match (this=0x7fd266d30a80, rec_ptr=0x7fd266f12028 <incomplete sequence \371\200>)
    at /git/mysql-server_dbg/sql/sql_join_buffer.cc:2046
#17 0x000055914638cc35 in JOIN_CACHE::generate_full_extensions (this=0x7fd266d30a80, 
    rec_ptr=0x7fd266f12028 <incomplete sequence \371\200>) at /git/mysql-server_dbg/sql/sql_join_buffer.cc:1999
#18 0x000055914638c9eb in JOIN_CACHE_BNL::join_matching_records (this=0x7fd266d30a80, skip_last=false)
    at /git/mysql-server_dbg/sql/sql_join_buffer.cc:1901
#19 0x000055914638c2eb in JOIN_CACHE::join_records (this=0x7fd266d30a80, skip_last=false)
    at /git/mysql-server_dbg/sql/sql_join_buffer.cc:1727
#20 0x000055914638f8ed in JOIN_CACHE::end_send (this=0x7fd266d30a80) at /git/mysql-server_dbg/sql/sql_join_buffer.h:495
#21 0x0000559145d97693 in sub_select_op (join=0x7fd266c9cc10, qep_tab=0x7fd266d30790, end_of_records=true)
    at /git/mysql-server_dbg/sql/sql_executor.cc:1255
#22 0x0000559145d97828 in sub_select (join=0x7fd266c9cc10, qep_tab=0x7fd266d30618, end_of_records=true)
    at /git/mysql-server_dbg/sql/sql_executor.cc:1406
#23 0x0000559145d972c8 in do_select (join=0x7fd266c9cc10) at /git/mysql-server_dbg/sql/sql_executor.cc:1146
#24 0x0000559145d944c7 in JOIN::exec (this=0x7fd266c9cc10) at /git/mysql-server_dbg/sql/sql_executor.cc:295
#25 0x0000559145e55266 in Sql_cmd_dml::execute_inner (this=0x7fd266c9c420, thd=0x7fd291b0f000)
    at /git/mysql-server_dbg/sql/sql_select.cc:651
#26 0x0000559145e54cf3 in Sql_cmd_dml::execute (this=0x7fd266c9c420, thd=0x7fd291b0f000)
    at /git/mysql-server_dbg/sql/sql_select.cc:554
#27 0x0000559145df763c in mysql_execute_command (thd=0x7fd291b0f000, first_level=true)
    at /git/mysql-server_dbg/sql/sql_parse.cc:4220
#28 0x0000559145df9bb2 in mysql_parse (thd=0x7fd291b0f000, parser_state=0x7fd2b1e6a330)
    at /git/mysql-server_dbg/sql/sql_parse.cc:4935
#29 0x0000559145def713 in dispatch_command (thd=0x7fd291b0f000, com_data=0x7fd2b1e6ac90, command=COM_QUERY)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1589
#30 0x0000559145dedfee in do_command (thd=0x7fd291b0f000) at /git/mysql-server_dbg/sql/sql_parse.cc:1214
#31 0x0000559145f83a70 in handle_connection (arg=0x7fd26686e420)
    at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#32 0x00005591478a3cf8 in pfs_spawn_thread (arg=0x7fd2a5be7820) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2814
#33 0x00007fd2b38986db in start_thread (arg=0x7fd2b1e6b700) at pthread_create.c:463
#34 0x00007fd2b1f8d88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
# mysqld options required for replay:  --sql_mode=ONLY_FULL_GROUP_BY
CREATE DATABASE test;
USE test;
create TABLE t1(a int,b CHAR (1));
insert INTO t1 values(2,"fullaaa fullzzz");
INSERT INTO t1 VALUES(6,'master only');
CREATE TEMPORARY TABLE t2(primary key (a))ENGINE=InnoDB select * from t1;
ALTER TABLE t1 MODIFY a TIME(1);
SELECT * FROM t1 JOIN t2 ON t1.a=t2.a WHERE NOT(t1.a NOT IN(t2.a,t2.b));
[24 Aug 2018 5:27] Umesh Shastry
Hello Roel,

Thank you for the report.
Observed that 8.0.11 debug build is affected but this is no longer reproducible on latest 8.0 builds after internal bug#27665997 fixed in 8.0.12.
Documented fix as follows in the MySQL 8.0.12 changelog: 

    Casting of VARBINARY values to TIME values was not 
    performed correctly. 

regards,
Umesh