Bug #92537 Assertion `num_codepoints >= scanner.get_char_index()' failed.
Submitted: 23 Sep 2018 23:42 Modified: 24 Sep 2018 4:34
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Charsets Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[23 Sep 2018 23:42] Roel Van de Paar
Description:
Bug 88278 was closed as fixed, but there seem to still be problems.

mysqld: /git/MS-8.0.12_dbg/strings/ctype-uca.cc:1997: size_t my_strnxfrm_uca(const CHARSET_INFO*, Mb_wc, uchar*, size_t, uint, const uchar*, size_t, uint) [with Mb_wc = Mb_wc_utf8mb4; size_t = long unsigned int; uchar = unsigned char; uint = unsigned int]: Assertion `num_codepoints >= scanner.get_char_index()' 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
[Current thread is 1 (Thread 0x7f3111e82700 (LWP 15419))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055c7fb7d078d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055c7fa524d94 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  0x00007f3111ec3801 in __GI_abort () at abort.c:79
#6  0x00007f3111eb339a in __assert_fail_base (fmt=0x7f311203a7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55c7fd1ee500 "num_codepoints >= scanner.get_char_index()", 
    file=file@entry=0x55c7fd1ed238 "/git/MS-8.0.12_dbg/strings/ctype-uca.cc", line=line@entry=1997, 
    function=function@entry=0x55c7fd1eecc0 <unsigned long my_strnxfrm_uca<Mb_wc_utf8mb4>(CHARSET_INFO const*, Mb_wc_utf8mb4, unsigned char*, unsigned long, unsigned int, unsigned char const*, unsigned long, unsigned int)::__PRETTY_FUNCTION__> "size_t my_strnxfrm_uca(const CHARSET_INFO*, Mb_wc, uchar*, size_t, uint, const uchar*, size_t, uint) [with Mb_wc = Mb_wc_utf8mb4; size_t = long unsigned int; uchar = unsigned char; uint = unsigned int"...) at assert.c:92
#7  0x00007f3111eb3412 in __GI___assert_fail (assertion=0x55c7fd1ee500 "num_codepoints >= scanner.get_char_index()", 
    file=0x55c7fd1ed238 "/git/MS-8.0.12_dbg/strings/ctype-uca.cc", line=1997, 
    function=0x55c7fd1eecc0 <unsigned long my_strnxfrm_uca<Mb_wc_utf8mb4>(CHARSET_INFO const*, Mb_wc_utf8mb4, unsigned char*, unsigned long, unsigned int, unsigned char const*, unsigned long, unsigned int)::__PRETTY_FUNCTION__> "size_t my_strnxfrm_uca(const CHARSET_INFO*, Mb_wc, uchar*, size_t, uint, const uchar*, size_t, uint) [with Mb_wc = Mb_wc_utf8mb4; size_t = long unsigned int; uchar = unsigned char; uint = unsigned int"...) at assert.c:101
#8  0x000055c7fc0d2dd8 in my_strnxfrm_uca<Mb_wc_utf8mb4> (cs=0x55c7fddeb040 <my_charset_utf8mb4_croatian_uca_ci>, mb_wc=..., 
    dst=0x7f30e9b8103d "", dstlen=384, num_codepoints=12, src=0x7f30e9827450 "20180900000000", srclen=14, flags=128)
    at /git/MS-8.0.12_dbg/strings/ctype-uca.cc:1997
#9  0x000055c7fc0c9401 in my_strnxfrm_any_uca (cs=0x55c7fddeb040 <my_charset_utf8mb4_croatian_uca_ci>, 
    dst=0x7f30e9b81021 "\016+\016)\016*\016\061\016)\016\062\016)\016)\016)\016)\016)\016)\016)\016)", dstlen=384, 
    num_codepoints=12, src=0x7f30e9827450 "20180900000000", srclen=14, flags=128) at /git/MS-8.0.12_dbg/strings/ctype-uca.cc:4583
#10 0x000055c7fa68ad51 in (anonymous namespace)::make_sortkey_from_item (item=0x7f30e99a44b0, result_type=STRING_RESULT, 
    dst_length=..., tmp_buffer=0x7f3111e7f828, 
    to=0x7f30e9b81021 "\016+\016)\016*\016\061\016)\016\062\016)\016)\016)\016)\016)\016)\016)\016)", to_end=0x7f30e9b89020 "", 
    maybe_null=0x7f3111e7f362, hash=0x7f3111e7f370) at /git/MS-8.0.12_dbg/sql/filesort.cc:1391
#11 0x000055c7fa68b66d in Sort_param::make_sortkey (this=0x7f3111e7f7d0, dst=..., ref_pos=0x7f30e98b3718 "    ")
    at /git/MS-8.0.12_dbg/sql/filesort.cc:1513
#12 0x000055c7fa68935c in alloc_and_make_sortkey (param=0x7f3111e7f7d0, fs_info=0x7f30e98466c0, ref_pos=0x7f30e98b3718 "    ")
    at /git/MS-8.0.12_dbg/sql/filesort.cc:840
#13 0x000055c7fa689b4e in read_all_rows (thd=0x7f30e9823000, param=0x7f3111e7f7d0, qep_tab=0x7f30e9a41028, fs_info=0x7f30e98466c0, 
    chunk_file=0x7f3111e7f9d0, tempfile=0x7f3111e7f8b0, pq=0x0, found_rows=0x7f3111e7fbc0)
    at /git/MS-8.0.12_dbg/sql/filesort.cc:1013
#14 0x000055c7fa6878b2 in filesort (thd=0x7f30e9823000, filesort=0x7f30e9a418c8, sort_positions=false, 
    examined_rows=0x7f3111e7fbb8, found_rows=0x7f3111e7fbc0, returned_rows=0x7f3111e7fbc8) at /git/MS-8.0.12_dbg/sql/filesort.cc:470
#15 0x000055c7fa91aa06 in create_sort_index (thd=0x7f30e9823000, join=0x7f30e99a5328, qep_tab=0x7f30e9a41028)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:5395
#16 0x000055c7fa91371a in QEP_TAB::sort_table (this=0x7f30e9a41028) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:2764
#17 0x000055c7fa912f6c in join_init_read_record (tab=0x7f30e9a41028) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:2617
#18 0x000055c7fa90fe08 in sub_select (join=0x7f30e99a5328, qep_tab=0x7f30e9a41028, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1512
#19 0x000055c7fa90f515 in do_select (join=0x7f30e99a5328) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1171
#20 0x000055c7fa90c621 in JOIN::exec (this=0x7f30e99a5328) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:294
#21 0x000055c7fa3d9a30 in Sql_cmd_dml::execute_inner (this=0x7f30e99a51a8, thd=0x7f30e9823000)
    at /git/MS-8.0.12_dbg/sql/sql_select.cc:651
#22 0x000055c7fa3d94bd in Sql_cmd_dml::execute (this=0x7f30e99a51a8, thd=0x7f30e9823000) at /git/MS-8.0.12_dbg/sql/sql_select.cc:554
#23 0x000055c7fa37ba19 in mysql_execute_command (thd=0x7f30e9823000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4210
#24 0x000055c7fa37df94 in mysql_parse (thd=0x7f30e9823000, parser_state=0x7f3111e81330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#25 0x000055c7fa373aeb in dispatch_command (thd=0x7f30e9823000, com_data=0x7f3111e81c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#26 0x000055c7fa3723c6 in do_command (thd=0x7f30e9823000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#27 0x000055c7fa512678 in handle_connection (arg=0x7f30ff7a5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#28 0x000055c7fbe81422 in pfs_spawn_thread (arg=0x7f31057e7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#29 0x00007f31138af6db in start_thread (arg=0x7f3111e82700) at pthread_create.c:463
#30 0x00007f3111fa488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
# mysqld options required for replay: --sql_mode= 
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 FLOAT,c2 CHAR,c3 INT,c4 CHAR KEY,c5 FLOAT UNIQUE KEY,c6 DECIMAL(0,0)DEFAULT 3.141592);
INSERT INTO t1(c1)VALUES(NOW()) ON DUPLICATE KEY UPDATE c1=ADDTIME(NOW(),'');
SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR'')FROM t1 GROUP BY c1 COLLATE utf8mb4_croatian_ci;
[23 Sep 2018 23:48] Roel Van de Paar
Bug 88256 I meant
[24 Sep 2018 4:34] Umesh Shastry
Hello Roel,

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

regards,
Umesh
[26 Sep 2018 4:12] Umesh Shastry
Bug #92569 marked as duplicate of this one.