Bug #93701 Assertion `maybe_null' failed |Item_func_concat::val_str(String*)
Submitted: 20 Dec 2018 11:25 Modified: 8 Feb 2:06
Reporter: Ramesh Sivaraman (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S6 (Debug Builds)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[20 Dec 2018 11:25] Ramesh Sivaraman
Description:
GDB info

#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x000000000456c0a9 in my_write_core (sig=6) at /qa/binaries/MS-8.0_val_dbg/mysys/stacktrace.cc:278
#2  0x00000000031c38c1 in handle_fatal_signal (sig=6) at /qa/binaries/MS-8.0_val_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  0x00007f4dc8808428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007f4dc880a02a in __GI_abort () at abort.c:89
#6  0x00007f4dc8800bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x575bb6e "maybe_null", file=file@entry=0x575c200 "/qa/binaries/MS-8.0_val_dbg/sql/item_strfunc.cc", line=line@entry=951, function=function@entry=0x575d0a0 <Item_func_concat::val_str(String*)::__PRETTY_FUNCTION__> "virtual String* Item_func_concat::val_str(String*)") at assert.c:92
#7  0x00007f4dc8800c82 in __GI___assert_fail (assertion=0x575bb6e "maybe_null", file=0x575c200 "/qa/binaries/MS-8.0_val_dbg/sql/item_strfunc.cc", line=951, function=0x575d0a0 <Item_func_concat::val_str(String*)::__PRETTY_FUNCTION__> "virtual String* Item_func_concat::val_str(String*)") at assert.c:101
#8  0x0000000003486f88 in Item_func_concat::val_str (this=0x7f4cec00d7c8, str=0x7f4db4988a00) at /qa/binaries/MS-8.0_val_dbg/sql/item_strfunc.cc:951
#9  0x00000000033c51d9 in Item::send (this=0x7f4cec00d7c8, protocol=0x7f4cec001db8, buffer=0x7f4db4988a00) at /qa/binaries/MS-8.0_val_dbg/sql/item.cc:6527
#10 0x0000000002f6f9b0 in THD::send_result_set_row (this=0x7f4cec000c00, row_items=0x7f4cec00b710) at /qa/binaries/MS-8.0_val_dbg/sql/sql_class.cc:2580
#11 0x000000000357883a in Query_result_send::send_data (this=0x7f4cec00e358, items=...) at /qa/binaries/MS-8.0_val_dbg/sql/query_result.cc:93
#12 0x0000000002f95e44 in JOIN::exec (this=0x7f4cec0128c8) at /qa/binaries/MS-8.0_val_dbg/sql/sql_executor.cc:240
#13 0x0000000003067960 in Sql_cmd_dml::execute_inner (this=0x7f4cec00e2f8, thd=0x7f4cec000c00) at /qa/binaries/MS-8.0_val_dbg/sql/sql_select.cc:697
#14 0x0000000003067387 in Sql_cmd_dml::execute (this=0x7f4cec00e2f8, thd=0x7f4cec000c00) at /qa/binaries/MS-8.0_val_dbg/sql/sql_select.cc:595
#15 0x0000000003001e96 in mysql_execute_command (thd=0x7f4cec000c00, first_level=true) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:4307
#16 0x000000000300491a in mysql_parse (thd=0x7f4cec000c00, parser_state=0x7f4db498a380, force_primary_storage_engine=false) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:5041
#17 0x0000000002ff9ea4 in dispatch_command (thd=0x7f4cec000c00, com_data=0x7f4db498acf0, command=COM_QUERY) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:1687
#18 0x0000000002ff8506 in do_command (thd=0x7f4cec000c00) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:1260
#19 0x00000000031ae7d3 in handle_connection (arg=0x808fc90) at /qa/binaries/MS-8.0_val_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#20 0x0000000004c8928a in pfs_spawn_thread (arg=0x80550c0) at /qa/binaries/MS-8.0_val_dbg/storage/perfschema/pfs.cc:2836
#21 0x00007f4dca5266ba in start_thread (arg=0x7f4db498b700) at pthread_create.c:333
#22 0x00007f4dc88da41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

How to repeat:
Testcase

rm -Rf /dev/shm/1545282901
mkdir -p /dev/shm/1545282901/tmp

/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug/bin/mysqld --no-defaults --initialize-insecure --basedir=/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug --datadir=/dev/shm/1545282901/data

/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug/bin/mysqld --no-defaults --basedir=/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug --datadir=/dev/shm/1545282901/data --tmpdir=/dev/shm/1545282901/tmp --port=32828 --pid-file=/dev/shm/1545282901/pid.pid --core-file --socket=/dev/shm/1545282901/socket.sock --max-allowed-packet=24  --sql_mode= --log-error=/dev/shm/1545282901/error.log.out &

SET collation_connection=utf32_unicode_ci;
SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)),'"');
[20 Dec 2018 11:25] Ramesh Sivaraman
Similar to https://bugs.mysql.com/bug.php?id=83115
[20 Dec 2018 14:05] Miguel Solorzano
Thank you for the bug report.
[8 Feb 2:06] Jon Stephens
Documented fix as follows in the MySQL 8.0.16 changelog:

    In debug builds, When strict SQL mode was not in effect, the
    CONCAT() and CONCAT_WS() functions raised an assertion if the
    result was longer than max_allowed_packet.

Closed.
[11 Feb 21:19] Jon Stephens
See also BUG#94102