Bug #91986 write(IO_CACHE*): Assertion `charset_database_number <= 0xFF' failed.
Submitted: 13 Aug 2018 2:18 Modified: 25 Oct 2018 8:10
Reporter: Roel Van de Paar Email Updates:
Status: Can't repeat 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

[13 Aug 2018 2:18] Roel Van de Paar
Description:
mysqld: /git/MS-8.0.12_dbg/sql/log_event.cc:4030: virtual bool Query_log_event::write(IO_CACHE*): Assertion `charset_database_number <= 0xFF' 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
57      ../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7fb43317c700 (LWP 2649))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055e7d28b578d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055e7d1609d94 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  0x00007fb4331bd801 in __GI_abort () at abort.c:79
#6  0x00007fb4331ad39a in __assert_fail_base (fmt=0x7fb4333347d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0x55e7d3d3c3e0 "charset_database_number <= 0xFF",
    file=file@entry=0x55e7d3d3a3f8 "/git/MS-8.0.12_dbg/sql/log_event.cc", line=line@entry=4030,
    function=function@entry=0x55e7d3d41540 <Query_log_event::write(IO_CACHE*)::__PRETTY_FUNCTION__> "virtual bool Query_log_event::write(IO_CACHE*)") at assert.c:92
#7  0x00007fb4331ad412 in __GI___assert_fail (assertion=0x55e7d3d3c3e0 "charset_database_number <= 0xFF",
    file=0x55e7d3d3a3f8 "/git/MS-8.0.12_dbg/sql/log_event.cc", line=4030,
    function=0x55e7d3d41540 <Query_log_event::write(IO_CACHE*)::__PRETTY_FUNCTION__> "virtual bool Query_log_event::write(IO_CACHE*)") at assert.c:101
#8  0x000055e7d249463d in Query_log_event::write (this=0x7fb433176090, file=0x7fb404cf32a8)
    at /git/MS-8.0.12_dbg/sql/log_event.cc:4030
#9  0x000055e7d24c1b45 in binlog_cache_data::write_event (this=0x7fb404cf32a0, thd=0x7fb404c23000, ev=0x7fb433176090)
    at /git/MS-8.0.12_dbg/sql/binlog.cc:1348
#10 0x000055e7d24d5434 in MYSQL_BIN_LOG::write_event (this=0x55e7d4f62dc0 <mysql_bin_log>, event_info=0x7fb433176090)
    at /git/MS-8.0.12_dbg/sql/binlog.cc:6948
#11 0x000055e7d24e168e in THD::binlog_query (this=0x7fb404c23000, qtype=THD::STMT_QUERY_TYPE,
    query_arg=0x7fb404c192e0 "DROP TABLE IF EXISTS `a`.`b` /* generated by server */", query_len=54, is_trans=false, direct=false,
    suppress_use=false, errcode=0) at /git/MS-8.0.12_dbg/sql/binlog.cc:11344
#12 0x000055e7d1525146 in Drop_tables_query_builder::write_bin_log (this=0x7fb4331770e0)
    at /git/MS-8.0.12_dbg/sql/sql_table.cc:1721
#13 0x000055e7d14f9092 in mysql_rm_table_no_locks (thd=0x7fb404c23000, tables=0x7fb404c6fae0, if_exists=true,
    drop_temporary=false, drop_database=false, dropped_non_atomic_flag=0x7fb433179051, post_ddl_htons=0x7fb4331790c0,
    fk_invalidator=0x7fb4331790f0, safe_to_release_mdl=0x7fb433179080) at /git/MS-8.0.12_dbg/sql/sql_table.cc:2990
#14 0x000055e7d14f5149 in mysql_rm_table (thd=0x7fb404c23000, tables=0x7fb404c6fae0, if_exists=true, drop_temporary=false)
   S-8.0.12_dbg/sql/sql_table.cc:1454
#15 0x000055e7d145d5fe in mysql_execute_command (thd=0x7fb404c23000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:3239
#16 0x000055e7d1462f94 in mysql_parse (thd=0x7fb404c23000, parser_state=0x7fb43317b330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#17 0x000055e7d1458aeb in dispatch_command (thd=0x7fb404c23000, com_data=0x7fb43317bc90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#18 0x000055e7d14573c6 in do_command (thd=0x7fb404c23000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#19 0x000055e7d15f7678 in handle_connection (arg=0x7fb420bbd480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#20 0x000055e7d2f66422 in pfs_spawn_thread (arg=0x7fb426be7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#21 0x00007fb434ba96db in start_thread (arg=0x7fb43317c700) at pthread_create.c:463
#22 0x00007fb43329e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
SET @5000000000000000 = @@GLOBAL . stored_program_cache ;
SET @@SESSION . collation_database = @5000000000000000 ;
DROP TABLE IF EXISTS a . b; ;
[13 Aug 2018 4:06] MySQL Verification Team
Hello Roel,

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

thanks,
Umesh
[25 Oct 2018 8:10] Erlend Dahl
Posted by developer -  Thayumanavar X Sachithanantha

This is not reproducible on the recent 8.0 build. I am closing this as not
reproducible.
[25 Oct 2018 8:50] MySQL Verification Team
This was a duplicate of mine.

Bug 28015761 - BINLOG CACHE: ASSERTION FAILED: CHARSET_DATABASE_NUMBER <= 0XFF

Changelog entry added for MySQL 8.0.13:
In debug builds, an assertion failed because more than 255 collations are now
available in MySQL.