Bug #92569 Assertion `num_codepoints >= scanner.get_char_index()' failed.
Submitted: 26 Sep 2018 0:43 Modified: 26 Sep 2018 8:19
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Charsets Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[26 Sep 2018 0:43] Roel Van de Paar
Description:
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_through_function_pointer; 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 0x7f87338b4700 (LWP 7185))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055881268878d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x00005588113dcd94 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  0x00007f87338f5801 in __GI_abort () at abort.c:79
#6  0x00007f87338e539a in __assert_fail_base (fmt=0x7f8733a6c7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x5588140a6500 "num_codepoints >= scanner.get_char_index()", 
    file=file@entry=0x5588140a5238 "/git/MS-8.0.12_dbg/strings/ctype-uca.cc", line=line@entry=1997, 
    function=function@entry=0x5588140a6da0 <unsigned long my_strnxfrm_uca<Mb_wc_through_function_pointer>(CHARSET_INFO const*, Mb_wc_through_function_pointer, 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_through_function_pointer; size_t = long unsigned int; uchar = unsigned char; ui"...) at assert.c:92
#7  0x00007f87338e5412 in __GI___assert_fail (assertion=0x5588140a6500 "num_codepoints >= scanner.get_char_index()", 
    file=0x5588140a5238 "/git/MS-8.0.12_dbg/strings/ctype-uca.cc", line=1997, 
    function=0x5588140a6da0 <unsigned long my_strnxfrm_uca<Mb_wc_through_function_pointer>(CHARSET_INFO const*, Mb_wc_through_function_pointer, 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_through_function_pointer; size_t = long unsigned int; uchar = unsigned char; ui"...) at assert.c:101
#8  0x0000558812f8b70d in my_strnxfrm_uca<Mb_wc_through_function_pointer> (cs=0x558814ca09c0 <my_charset_utf8_icelandic_uca_ci>, 
    mb_wc=..., dst=0x7f870b24d041 "", dstlen=288, num_codepoints=12, src=0x7f870b0267a0 "-1", '0' <repeats 14 times>, srclen=16, 
    flags=128) at /git/MS-8.0.12_dbg/strings/ctype-uca.cc:1997
#9  0x0000558812f81448 in my_strnxfrm_any_uca (cs=0x558814ca09c0 <my_charset_utf8_icelandic_uca_ci>, 
    dst=0x7f870b24d021 "\002!\016*\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)", dstlen=288, 
    num_codepoints=12, src=0x7f870b0267a0 "-1", '0' <repeats 14 times>, srclen=16, flags=128)
    at /git/MS-8.0.12_dbg/strings/ctype-uca.cc:4588
#10 0x0000558811542d51 in (anonymous namespace)::make_sortkey_from_item (item=0x7f870b1034a0, result_type=STRING_RESULT, 
    dst_length=..., tmp_buffer=0x7f87338b1828, 
    to=0x7f870b24d021 "\002!\016*\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)\016)", to_end=0x7f870b255020 "", 
    maybe_null=0x7f87338b1362, hash=0x7f87338b1370) at /git/MS-8.0.12_dbg/sql/filesort.cc:1391
#11 0x000055881154366d in Sort_param::make_sortkey (this=0x7f87338b17d0, dst=..., ref_pos=0x7f870b0ae508 "")
    at /git/MS-8.0.12_dbg/sql/filesort.cc:1513
#12 0x000055881154135c in alloc_and_make_sortkey (param=0x7f87338b17d0, fs_info=0x7f870b0c24c0, ref_pos=0x7f870b0ae508 "")
    at /git/MS-8.0.12_dbg/sql/filesort.cc:840
#13 0x0000558811541b4e in read_all_rows (thd=0x7f870b023000, param=0x7f87338b17d0, qep_tab=0x7f870b144da8, fs_info=0x7f870b0c24c0, 
    chunk_file=0x7f87338b19d0, tempfile=0x7f87338b18b0, pq=0x0, found_rows=0x7f87338b1bc0)
    at /git/MS-8.0.12_dbg/sql/filesort.cc:1013
#14 0x000055881153f8b2 in filesort (thd=0x7f870b023000, filesort=0x7f870b145648, sort_positions=false, 
    examined_rows=0x7f87338b1bb8, found_rows=0x7f87338b1bc0, returned_rows=0x7f87338b1bc8) at /git/MS-8.0.12_dbg/sql/filesort.cc:470
#15 0x00005588117d2a06 in create_sort_index (thd=0x7f870b023000, join=0x7f870b144330, qep_tab=0x7f870b144da8)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:5395
#16 0x00005588117cb71a in QEP_TAB::sort_table (this=0x7f870b144da8) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:2764
#17 0x00005588117caf6c in join_init_read_record (tab=0x7f870b144da8) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:2617
#18 0x00005588117c7e08 in sub_select (join=0x7f870b144330, qep_tab=0x7f870b144da8, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1512
#19 0x00005588117c7515 in do_select (join=0x7f870b144330) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1171
#20 0x00005588117c4621 in JOIN::exec (this=0x7f870b144330) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:294
#21 0x0000558811291a30 in Sql_cmd_dml::execute_inner (this=0x7f870b144188, thd=0x7f870b023000)
    at /git/MS-8.0.12_dbg/sql/sql_select.cc:651
#22 0x00005588112914bd in Sql_cmd_dml::execute (this=0x7f870b144188, thd=0x7f870b023000) at /git/MS-8.0.12_dbg/sql/sql_select.cc:554
#23 0x0000558811233a19 in mysql_execute_command (thd=0x7f870b023000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4210
#24 0x0000558811235f94 in mysql_parse (thd=0x7f870b023000, parser_state=0x7f87338b3330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#25 0x000055881122baeb in dispatch_command (thd=0x7f870b023000, com_data=0x7f87338b3c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#26 0x000055881122a3c6 in do_command (thd=0x7f870b023000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#27 0x00005588113ca678 in handle_connection (arg=0x7f87213a5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#28 0x0000558812d39422 in pfs_spawn_thread (arg=0x7f87273e7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#29 0x00007f87352e16db in start_thread (arg=0x7f87338b4700) at pthread_create.c:463
#30 0x00007f87339d688f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TEMPORARY TABLE sbtest1(c1 FLOAT);
insert INTO sbtest1 values(-99999999999999),(-1),('+1'),(0),('+00000000000001'),('+12345678901'),(1);
select group_concat(c1 order by c1)FROM sbtest1 group by c1 collate utf8_icelandic_ci;
[26 Sep 2018 0:43] Roel Van de Paar
Ref bug 88278
[26 Sep 2018 0:50] Roel Van de Paar
Ref bug 92537 (different testcase!)
[26 Sep 2018 4:12] Umesh Shastry
Hello Roel,

Thank you for the report and test case.
Observed that only 8.0.12 debug build is affected, looking at the bt this is duplicate of your earlier Bug #92537.

regards,
Umesh
[26 Sep 2018 8:19] Roel Van de Paar
For this bug, the testcase is different.

I would disagree with the new "S6" severity and change thereunto. Please discuss the following internally;

1) Severity has always been a field which is customer-set, and not changed by MySQL. Has this practice changed?

2) Marking something "debug only" and "low severity" (S6 is even below a feature request?) - especially if it is meant as "not so bad" - seems a very poor practice as serious bugs could be lost/missed/masked this way, and serious issues may not be handled with proper importance. It is not because something reproduces on debug only that it cannot be (very) serious.
[26 Sep 2018 15:17] Frederic Descamps
Hi Roel,

We haven't changed our practice to let the customer/user set the severity. Nor we have changed our policy of changing the level of severity where appropriate.

As we introduced only recently the two new levels S6 and S7, and as this issue is obviously a bug related to a debug build, the severity level had been modified to S6. S1 and S2 must be reproducible against Release Builds.

Severity is used to highlight the impact of the bug on a production system. The definitions for S1 and S2 have not changed. Debug only bugs have very low (no) impact on production systems and the new value is simply to make this point clearer, both for when filing and for users who are trying to asses the impact of bugs.

Thank you for supporting MySQL and I hope you will keep reporting your findings.

Cheers,

lefred