Bug #91763 data dictinary crash on debug build
Submitted: 23 Jul 2018 12:44 Modified: 5 Sep 2018 12:49
Reporter: Vlad Lesin (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[23 Jul 2018 12:44] Vlad Lesin
Description:
If we try to execute the following query on debug build:

CREATE TABLE `t2` (
`col2` varbinary(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS (`col2`) (
PARTITION custom_p1 VALUES IN (0x98000)
);

we will get the following crash:

#0  0x00007ffff5ebb428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff5ebd02a in __GI_abort () at abort.c:89
#2  0x00007ffff5eb3bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x55ca1a4 "rc == TYPE_OK", 
    file=file@entry=0x55ca138 "./sql/dd/impl/raw/raw_record.cc", line=line@entry=158, 
    function=function@entry=0x55ca2e0 <dd::Raw_record::store(int, std::__cxx11::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool)::__PRETTY_FUNCTION__> "bool dd::Raw_record::store(int, const String_type&, bool)") at assert.c:92
#3  0x00007ffff5eb3c82 in __GI___assert_fail (assertion=0x55ca1a4 "rc == TYPE_OK", 
    file=0x55ca138 "./sql/dd/impl/raw/raw_record.cc", line=158, 
    function=0x55ca2e0 <dd::Raw_record::store(int, std::__cxx11::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool)::__PRETTY_FUNCTION__> "bool dd::Raw_record::store(int, const String_type&, bool)") at assert.c:101
#4  0x0000000003f33c78 in dd::Raw_record::store (this=0x7fff4803f710, field_no=5, s="'\t\200\\0'", is_null=false)
    at ./sql/dd/impl/raw/raw_record.cc:158
#5  0x0000000003fbe009 in dd::Partition_impl::store_attributes (this=0x7fff480f0da0, r=0x7fff4803f710)
    at ./sql/dd/impl/types/partition_impl.cc:272
#6  0x0000000003fea44b in dd::Weak_object_impl::store (this=0x7fff480f0da0, otx=0x7fffe8e9e630)
    at ./sql/dd/impl/types/weak_object_impl.cc:119
#7  0x0000000003d8c802 in dd::Collection<dd::Partition*>::store_items (this=0x7fff48441d40, otx=0x7fffe8e9e630)
    at ./sql/dd/collection.cc:211
#8  0x0000000003fcf731 in dd::Table_impl::store_children (this=0x7fff48441b50, otx=0x7fffe8e9e630)
    at ./sql/dd/impl/types/table_impl.cc:360
#9  0x0000000003fea584 in dd::Weak_object_impl::store (this=0x7fff48441b50, otx=0x7fffe8e9e630)
    at ./sql/dd/impl/types/weak_object_impl.cc:147
#10 0x0000000003f1c124 in dd::cache::Storage_adapter::store<dd::Table> (thd=0x7fff4801b830, object=0x7fff48441dc8)
    at ./sql/dd/impl/cache/storage_adapter.cc:296
#11 0x0000000003e0ff39 in dd::cache::Dictionary_client::store<dd::Table> (this=0x7fff4846c250, object=0x7fff48441dc8)
    at ./sql/dd/impl/cache/dictionary_client.cc:2422
#12 0x0000000002d2a8fa in rea_create_base_table (thd=0x7fff4801b830, path=0x7fffe8ea1b80 "./test/t2", sch_obj=..., db=0x7fff48191198 "test", 
    table_name=0x7fff480dc968 "t2", create_info=0x7fffe8ea2f70, create_fields=..., keys=0, key_info=0x7fff4818ac88, keys_onoff=Alter_info::ENABLE, fk_keys=0, 
    fk_key_info=0x7fff4818ac88, file=0x7fff481894a8, no_ha_table=false, do_not_store_in_dd=false, part_info=0x7fff48191458, binlog_to_trx_cache=0x7fffe8ea1e2e, 
    table_def_ptr=0x7fffe8ea0bd0, post_ddl_ht=0x7fffe8ea1e38) at ./sql/sql_table.cc:913
#13 0x0000000002d3a633 in create_table_impl (thd=0x7fff4801b830, schema=..., db=0x7fff48191198 "test", table_name=0x7fff480dc968 "t2", 
    error_table_name=0x7fff480dc968 "t2", path=0x7fffe8ea1b80 "./test/t2", create_info=0x7fffe8ea2f70, alter_info=0x7fffe8ea3060, internal_tmp_table=false, 
    select_field_count=0, find_parent_keys=true, no_ha_table=false, do_not_store_in_dd=false, is_trans=0x7fffe8ea1e2e, key_info=0x7fffe8ea0be0, 
    key_count=0x7fffe8ea0bc8, keys_onoff=Alter_info::ENABLE, fk_key_info=0x7fffe8ea0be8, fk_key_count=0x7fffe8ea0bcc, existing_fk_info=0x0, existing_fk_count=0, 
    fk_max_generated_name_number=0, table_def=0x7fffe8ea0bd0, post_ddl_ht=0x7fffe8ea1e38) at ./sql/sql_table.cc:6128
#14 0x0000000002d3ad3c in mysql_create_table_no_lock (thd=0x7fff4801b830, db=0x7fff48191198 "test", table_name=0x7fff480dc968 "t2", create_info=0x7fffe8ea2f70, 
    alter_info=0x7fffe8ea3060, select_field_count=0, find_parent_keys=true, is_trans=0x7fffe8ea1e2e, post_ddl_ht=0x7fffe8ea1e38)
    at ./sql/sql_table.cc:6210
#15 0x0000000002d3d507 in mysql_create_table (thd=0x7fff4801b830, create_table=0x7fff48190c10, create_info=0x7fffe8ea2f70, alter_info=0x7fffe8ea3060)
    at ./sql/sql_table.cc:6749
#16 0x000000000321d464 in Sql_cmd_create_table::execute (this=0x7fff48191358, thd=0x7fff4801b830)
    at ./sql/sql_cmd_ddl_table.cc:319
#17 0x0000000002c97dcb in mysql_execute_command (thd=0x7fff4801b830, first_level=true) at ./sql/sql_parse.cc:3216
#18 0x0000000002c9d882 in mysql_parse (thd=0x7fff4801b830, parser_state=0x7fffe8ea5390) at ./sql/sql_parse.cc:4935
#19 0x0000000002c933d4 in dispatch_command (thd=0x7fff4801b830, com_data=0x7fffe8ea5cf0, command=COM_QUERY)
    at ./sql/sql_parse.cc:1589
#20 0x0000000002c91c8d in do_command (thd=0x7fff4801b830) at ./sql/sql_parse.cc:1214
#21 0x0000000002e29235 in handle_connection (arg=0x6c28460) at ./sql/conn_handler/connection_handler_per_thread.cc:308
#22 0x00000000047a13c2 in pfs_spawn_thread (arg=0x6cb9d30) at ./storage/perfschema/pfs.cc:2814
#23 0x00007ffff79be6ba in start_thread (arg=0x7fffe8ea6700) at pthread_create.c:333
#24 0x00007ffff5f8d41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

How to repeat:
1) Build 8.0.11 with the following options:

cd $BUILD_DIR

cmake $SOURCE_DIR -DCMAKE_BUILD_TYPE=Debug -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DDOWNLOAD_BOOST=1 -DENABLE_DOWNLOADS=1 -DWITH_SSL=system

2) Put the following test:

=====dict_crash.test=======
CREATE TABLE `t2` (
`col2` varbinary(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS (`col2`) (
PARTITION custom_p1 VALUES IN (0x98000)
);

drop table t2;
===========================

in $SOURCE_DIR/mysql-test/t/.

3) Launch the above test from "$BUILD_DIR/mysql-test/t" with the following command:

./mtr --max-test-fail=1 --debug-server dict_crash
[23 Jul 2018 12:53] Vlad Lesin
Step 3, launch the test from "$BUILD_DIR/mysql-test/" directory.
[23 Jul 2018 13:12] Umesh Shastry
Hello Vlad,

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

Thanks,
Umesh
[5 Sep 2018 12:49] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.14 release, and here's the changelog entry:

Creating a table with a partition description containing illegal utf8
characters raised an assertion.