Bug #92448 Assertion `uint4korr(kp1) >= 4' failed.
Submitted: 17 Sep 2018 4:19 Modified: 22 Nov 2018 6:20
Reporter: Roel Van de Paar Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[17 Sep 2018 4:19] Roel Van de Paar
Description:
mysqld: /git/MS-8.0.12_dbg/sql/cmp_varlen_keys.h:64: bool cmp_varlen_keys(Bounds_checked_array<st_sort_field>, bool, const uchar*, const uchar*): Assertion `uint4korr(kp1) >= 4' failed.

Core was generated by `/sda/MS300718-mysql-8.0.12-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
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055c0c4e3a78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055c0c3b8ed94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_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  0x00007f6a7e499801 in __GI_abort () at abort.c:79
#6  0x00007f6a7e48939a in __assert_fail_base (fmt=0x7f6a7e6107d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55c0c5f4ce81 "uint4korr(kp1) >= 4", 
    file=file@entry=0x55c0c5f4ce58 "/git/MS-8.0.12_dbg/sql/cmp_varlen_keys.h", line=line@entry=64, 
    function=function@entry=0x55c0c5f4eae0 <cmp_varlen_keys(Bounds_checked_array<st_sort_field>, bool, unsigned char const*, unsigned char const*)::__PRETTY_FUNCTION__> "bool cmp_varlen_keys(Bounds_checked_array<st_sort_field>, bool, const uchar*, const uchar*)")
    at assert.c:92
#7  0x00007f6a7e489412 in __GI___assert_fail (assertion=0x55c0c5f4ce81 "uint4korr(kp1) >= 4", 
    file=0x55c0c5f4ce58 "/git/MS-8.0.12_dbg/sql/cmp_varlen_keys.h", line=64, 
    function=0x55c0c5f4eae0 <cmp_varlen_keys(Bounds_checked_array<st_sort_field>, bool, unsigned char const*, unsigned char const*)::__PRETTY_FUNCTION__> "bool cmp_varlen_keys(Bounds_checked_array<st_sort_field>, bool, const uchar*, const uchar*)")
    at assert.c:101
#8  0x000055c0c3cfa3ab in cmp_varlen_keys (sort_field_array=..., use_hash=false, s1=0x7f6a500a9734 "", s2=0x7f6a500a9720 "\001")
    at /git/MS-8.0.12_dbg/sql/cmp_varlen_keys.h:64
#9  0x000055c0c3cf0776 in (anonymous namespace)::Mem_compare_queue_key::operator() (this=0x7f6a7e455380, s1=0x7f6a500a9734 "", 
    s2=0x7f6a500a9720 "\001") at /git/MS-8.0.12_dbg/sql/filesort.cc:121
#10 0x000055c0c3cf954e in Priority_queue<unsigned char*, std::vector<unsigned char*, Malloc_allocator<unsigned char*> >, (anonymous namespace)::Mem_compare_queue_key>::reverse_heapify (this=0x7f6a7e455380, i=1) at /git/MS-8.0.12_dbg/include/priority_queue.h:151
#11 0x000055c0c3cf918d in Priority_queue<unsigned char*, std::vector<unsigned char*, Malloc_allocator<unsigned char*> >, (anonymous namespace)::Mem_compare_queue_key>::push (this=0x7f6a7e455380, x=@0x7f6a50089c78: 0x7f6a500a9734 "")
    at /git/MS-8.0.12_dbg/include/priority_queue.h:228
#12 0x000055c0c3cf8c66 in Bounded_queue<unsigned char*, unsigned char*, Sort_param, (anonymous namespace)::Mem_compare_queue_key>::push (this=0x7f6a7e455380, element=0x7f6a500df750 <incomplete sequence \343>) at /git/MS-8.0.12_dbg/sql/bounded_queue.h:111
#13 0x000055c0c3cf3b29 in read_all_rows (thd=0x7f6a50054000, param=0x7f6a7e455470, qep_tab=0x7f6a7e455ba8, fs_info=0x7f6a500f34c0, 
    chunk_file=0x7f6a7e455670, tempfile=0x7f6a7e455550, pq=0x7f6a7e455380, found_rows=0x7f6a7e455888)
    at /git/MS-8.0.12_dbg/sql/filesort.cc:1011
#14 0x000055c0c3cf18b2 in filesort (thd=0x7f6a50054000, filesort=0x7f6a7e455930, sort_positions=true, 
    examined_rows=0x7f6a7e455880, found_rows=0x7f6a7e455888, returned_rows=0x7f6a7e455890)
    at /git/MS-8.0.12_dbg/sql/filesort.cc:470
#15 0x000055c0c3ae16f5 in Sql_cmd_update::update_single_table (this=0x7f6a50177e48, thd=0x7f6a50054000)
    at /git/MS-8.0.12_dbg/sql/sql_update.cc:562
#16 0x000055c0c3ae4f40 in Sql_cmd_update::execute_inner (this=0x7f6a50177e48, thd=0x7f6a50054000)
    at /git/MS-8.0.12_dbg/sql/sql_update.cc:1515
#17 0x000055c0c3a434bd in Sql_cmd_dml::execute (this=0x7f6a50177e48, thd=0x7f6a50054000)
    at /git/MS-8.0.12_dbg/sql/sql_select.cc:554
#18 0x000055c0c39e2536 in mysql_execute_command (thd=0x7f6a50054000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:3228
#19 0x000055c0c39e7f94 in mysql_parse (thd=0x7f6a50054000, parser_state=0x7f6a7e457330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#20 0x000055c0c39ddaeb in dispatch_command (thd=0x7f6a50054000, com_data=0x7f6a7e457c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#21 0x000055c0c39dc3c6 in do_command (thd=0x7f6a50054000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#22 0x000055c0c3b7c678 in handle_connection (arg=0x7f6a6bfa5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#23 0x000055c0c54eb422 in pfs_spawn_thread (arg=0x7f6a71fe7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#24 0x00007f6a7fe856db in start_thread (arg=0x7f6a7e458700) at pthread_create.c:463
#25 0x00007f6a7e57a88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
# mysqld options required for replay:  --sql_mode= 
SOURCE testcase13.sql   # uploaded
[17 Sep 2018 4:20] Roel Van de Paar
testcase13.sql

Attachment: testcase13.sql (application/sql, text), 3.63 KiB.

[17 Sep 2018 4:48] Roel Van de Paar
The EOL remarks (;#...) in the testcase are not meant to indicate anything specific as to this bug, they are a leftover from test logging.
[17 Sep 2018 4:49] MySQL Verification Team
Hello Roel,

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

regards,
Umesh
[18 Sep 2018 10:26] Steinar Gunderson
Posted by developer:
 
Duplicate of #27970481 (fixed in trunk in May), closing.
[25 Sep 2018 3:33] Roel Van de Paar
Please test against latest trunk to ensure this bug is fixed, thank you
[14 Oct 2018 17:10] Roel Van de Paar
Another testcase

# mysqld options required for replay: --sql_mode= --maximum-bulk_insert_buffer_size=1M
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 VARCHAR(0)NOT NULL);
INSERT INTO t1 VALUES(CURRENT_USER()),(0);
SELECT * FROM t1 ORDER BY c1 LIMIT 2;
[22 Nov 2018 6:16] Roel Van de Paar
Confirmed fixed in 8.0.13 with the last testcase in this bug.
[22 Nov 2018 6:20] Roel Van de Paar
SOURCE testcase also confirmed working (gives dup key error now)
[22 Nov 2018 6:20] Roel Van de Paar
Tested against opt + dbg