Bug #88352 bool Item::get_date_from_time(MYSQL_TIME*): Assertion `null_value' failed.
Submitted: 3 Nov 2017 22:17 Modified: 8 Nov 2017 12:06
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:8.0.3 RC OS:Any
Assigned to: CPU Architecture:Any

[3 Nov 2017 22:17] Roel Van de Paar
Description:
2017-11-03T21:39:11.534204Z 0 [Note] /sda/MS201017-mysql-8.0.3-rc-linux-x86_64-debug/bin/mysqld: ready for connections. Version: '8.0.3-rc-debug-log'  socket: '/sda/MS201017-mysql-8.0.3-rc-linux-x86_64-debug/socket.sock'  port: 16654  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/sql/item.cc:1374: bool Item::get_date_from_time(MYSQL_TIME*): Assertion `null_value' failed.
21:45:03 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS201017-mysql-8.0.3-rc-linux-x86_64-debug/bin/mysqld --no-defaults --sql_'.
Program terminated with signal 6, Aborted.
#0  0x00007fe98e9f59b1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61	  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007fe98e9f59b1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x000000000369e428 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.cc:291
#2  0x000000000286b8f6 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:234
#3  <signal handler called>
#4  0x00007fe98cd0d1f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fe98cd0e8e8 in __GI_abort () at abort.c:90
#6  0x00007fe98cd06266 in __assert_fail_base (fmt=0x7fe98ce58e68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x44427b3 "null_value", file=file@entry=0x44425e8 "/git/mysql-server_dbg/sql/item.cc", 
    line=line@entry=1374, 
    function=function@entry=0x4444640 <Item::get_date_from_time(st_mysql_time*)::__PRETTY_FUNCTION__> "bool Item::get_date_from_time(MYSQL_TIME*)") at assert.c:92
#7  0x00007fe98cd06312 in __GI___assert_fail (assertion=0x44427b3 "null_value", file=0x44425e8 "/git/mysql-server_dbg/sql/item.cc", 
    line=1374, 
    function=0x4444640 <Item::get_date_from_time(st_mysql_time*)::__PRETTY_FUNCTION__> "bool Item::get_date_from_time(MYSQL_TIME*)")
    at assert.c:101
#8  0x0000000002a1c862 in Item::get_date_from_time (this=0x7fe947c30f28, ltime=0x7fe98ef99780)
    at /git/mysql-server_dbg/sql/item.cc:1374
#9  0x0000000002b30104 in Item_time_func::get_date (this=0x7fe947c30f28, res=0x7fe98ef99780)
    at /git/mysql-server_dbg/sql/item_timefunc.h:853
#10 0x0000000002a199e0 in Item::val_date_temporal (this=0x7fe947c30f28) at /git/mysql-server_dbg/sql/item.cc:411
#11 0x0000000002a45aea in get_datetime_value (thd=0x7fe947c19000, item_arg=0x7fe947db7960, cache_arg=0x7fe947db79a0, 
    warn_item=0x7fe947db7150, is_null=0x7fe98ef99886) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:1396
#12 0x0000000002a45e05 in Arg_comparator::compare_datetime (this=0x7fe947db7958) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:1519
#13 0x0000000002a5990c in Arg_comparator::compare (this=0x7fe947db7958) at /git/mysql-server_dbg/sql/item_cmpfunc.h:118
#14 0x0000000002a489f2 in Item_func_eq::val_int (this=0x7fe947db7888) at /git/mysql-server_dbg/sql/item_cmpfunc.cc:2504
#15 0x000000000245c0cd in QEP_TAB::skip_record (this=0x7fe98ef99db0, thd=0x7fe947c19000, skip_record_arg=0x7fe98ef99f36)
    at /git/mysql-server_dbg/sql/sql_executor.h:533
#16 0x0000000002597440 in Sql_cmd_update::update_single_table (this=0x7fe947db7418, thd=0x7fe947c19000)
    at /git/mysql-server_dbg/sql/sql_update.cc:806
#17 0x0000000002599c5e in Sql_cmd_update::execute_inner (this=0x7fe947db7418, thd=0x7fe947c19000)
    at /git/mysql-server_dbg/sql/sql_update.cc:1683
#18 0x0000000002512627 in Sql_cmd_dml::execute (this=0x7fe947db7418, thd=0x7fe947c19000)
    at /git/mysql-server_dbg/sql/sql_select.cc:605
#19 0x00000000024bad4d in mysql_execute_command (thd=0x7fe947c19000, first_level=true)
    at /git/mysql-server_dbg/sql/sql_parse.cc:3441
#20 0x00000000024c042b in mysql_parse (thd=0x7fe947c19000, parser_state=0x7fe98ef9b2f0)
    at /git/mysql-server_dbg/sql/sql_parse.cc:5414
#21 0x00000000024b68e7 in dispatch_command (thd=0x7fe947c19000, com_data=0x7fe98ef9bb80, command=COM_QUERY)
#22 0x00000000024b53f5 in do_command (thd=0x7fe947c19000) at /git/mysql-server_dbg/sql/sql_parse.cc:1291
#23 0x000000000285b2d6 in handle_connection (arg=0x7fe97aee13c0)
    at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:328
#24 0x00000000036ec54d in pfs_spawn_thread (arg=0x7fe97af87520) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2985
#25 0x00007fe98e9f0e25 in start_thread (arg=0x7fe98ef9c700) at pthread_create.c:308
#26 0x00007fe98cdd034d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
# mysqld options required for replay:  --sql_mode= --server-id=1
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 TEXT BINARY CHARACTER SET 'utf8' COLLATE 'utf8_bin',c2 DATE,c3 TIMESTAMP)ENGINE=InnoDB;
INSERT INTO t1 VALUES(0.0e+308,0,0);
SET @@SESSION.SQL_MODE=(SELECT CONCAT(@@SQL_MODE,',STRICT_TRANS_TABLES'));
UPDATE t1 SET c1=CURRENT_TIMESTAMP()-100000 WHERE c2=MAKETIME(23-12-2340,0,0);
[4 Nov 2017 6:03] MySQL Verification Team
Hello Roel,

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

Thanks,
Umesh
[4 Nov 2017 6:04] MySQL Verification Team
-- 8.0.3 debug build

rm -rf 88352
bin/mysqld-debug --initialize-insecure --basedir=$PWD --datadir=$PWD/88352 
bin/mysqld-debug --no-defaults --sql_mode= --server-id=1 --basedir=$PWD --datadir=$PWD/88352 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=$PWD/88352/log.err 2>&1 &

(gdb) bt
#0  0x00007fc136b82771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000034fb0bb in my_write_core (sig=6) at ../../mysqlcom-pro-8.0.3-rc/mysys/stacktrace.cc:291
#2  0x00000000026d704a in handle_fatal_signal (sig=6) at ../../mysqlcom-pro-8.0.3-rc/sql/signal_handler.cc:234
#3  <signal handler called>
#4  0x00007fc13557c5d7 in raise () from /lib64/libc.so.6
#5  0x00007fc13557dcc8 in abort () from /lib64/libc.so.6
#6  0x00007fc135575546 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007fc1355755f2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000002888316 in Item::get_date_from_time (this=0x7fc0a41c8960, ltime=0x7fc1289f7920) at ../../mysqlcom-pro-8.0.3-rc/sql/item.cc:1374
#9  0x000000000299a492 in Item_time_func::get_date (this=0x7fc0a41c8960, res=0x7fc1289f7920) at ../../mysqlcom-pro-8.0.3-rc/sql/item_timefunc.h:853
#10 0x00000000028854ba in Item::val_date_temporal (this=0x7fc0a41c8960) at ../../mysqlcom-pro-8.0.3-rc/sql/item.cc:411
#11 0x00000000028b123f in get_datetime_value (thd=0x7fc0a4000be0, item_arg=0x7fc0a41c9130, cache_arg=0x7fc0a41c9170, warn_item=0x7fc0a41c8840, is_null=0x7fc1289f7a36)
    at ../../mysqlcom-pro-8.0.3-rc/sql/item_cmpfunc.cc:1396
#12 0x00000000028b1577 in Arg_comparator::compare_datetime (this=0x7fc0a41c9128) at ../../mysqlcom-pro-8.0.3-rc/sql/item_cmpfunc.cc:1519
#13 0x00000000028c502e in Arg_comparator::compare (this=0x7fc0a41c9128) at ../../mysqlcom-pro-8.0.3-rc/sql/item_cmpfunc.h:118
#14 0x00000000028b411a in Item_func_eq::val_int (this=0x7fc0a41c9058) at ../../mysqlcom-pro-8.0.3-rc/sql/item_cmpfunc.cc:2504
#15 0x00000000022c4043 in QEP_TAB::skip_record (this=0x7fc1289f7f40, thd=0x7fc0a4000be0, skip_record_arg=0x7fc1289f7d36)
    at ../../mysqlcom-pro-8.0.3-rc/sql/sql_executor.h:533
#16 0x000000000240135a in Sql_cmd_update::update_single_table (this=0x7fc0a41c8be8, thd=0x7fc0a4000be0) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_update.cc:806
#17 0x0000000002403b46 in Sql_cmd_update::execute_inner (this=0x7fc0a41c8be8, thd=0x7fc0a4000be0) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_update.cc:1681
#18 0x000000000237ac59 in Sql_cmd_dml::execute (this=0x7fc0a41c8be8, thd=0x7fc0a4000be0) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_select.cc:605
#19 0x0000000002322344 in mysql_execute_command (thd=0x7fc0a4000be0, first_level=true) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_parse.cc:3441
#20 0x0000000002327c0e in mysql_parse (thd=0x7fc0a4000be0, parser_state=0x7fc1289f9420) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_parse.cc:5414
#21 0x000000000231dead in dispatch_command (thd=0x7fc0a4000be0, com_data=0x7fc1289f9d10, command=COM_QUERY) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_parse.cc:1708
#22 0x000000000231c9ac in do_command (thd=0x7fc0a4000be0) at ../../mysqlcom-pro-8.0.3-rc/sql/sql_parse.cc:1291
#23 0x00000000026c69c3 in handle_connection (arg=0x9e21230) at ../../mysqlcom-pro-8.0.3-rc/sql/conn_handler/connection_handler_per_thread.cc:328
#24 0x000000000352d230 in pfs_spawn_thread (arg=0x9e79980) at ../../../mysqlcom-pro-8.0.3-rc/storage/perfschema/pfs.cc:2985
#25 0x00007fc136b7ddf5 in start_thread () from /lib64/libpthread.so.0
#26 0x00007fc13563d60d in clone () from /lib64/libc.so.6
(gdb)
[8 Nov 2017 12:06] Erlend Dahl
Not reproducible on 8.0.4, already fixed under the heading of

Bug#26740635 DAYOFYEAR FUNC: ASSERTION FAILED: NULL_VALUE