Bug #113860 Assertion `rc == TYPE_OK' CREATE TABLE sql/dd/impl/raw/raw_record.cc:158
Submitted: 2 Feb 1:22 Modified: 2 Feb 9:02
Reporter: Mikhail Izioumtchenko Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.3.0-debug, 8.0.36 OS:Oracle Linux (v9)
Assigned to: CPU Architecture:x86

[2 Feb 1:22] Mikhail Izioumtchenko
Description:
a CREATE TABLE results in this assert, reproducible:

mysqld: /var/lib/pb2/sb_1-13732982-1702568542.2358322/rpm/BUILD/mysql-8.3.0/mysql-8.3.0/sql/dd/impl/raw/raw_record.cc:158: bool dd::Raw_record::store(int, const dd::String_type&, bool): Assertion `rc == TYPE_OK' failed.
2024-02-01T19:00:27Z UTC - mysqld got signal 6 ;

How to repeat:
start mysqld-debug 8.3.0 and run this SQL:

(long, see attached file)
[2 Feb 1:23] Mikhail Izioumtchenko
testcase SQL

Attachment: bugct.sql (application/octet-stream, text), 3.43 MiB.

[2 Feb 1:28] Mikhail Izioumtchenko
despite obviously absurd table structure, an assert is an assert.

[root@LAPTOP-TJHMD4IG imatest]# cat /root/mysql-sandboxes/4202/*/error.log
mysqld: /var/lib/pb2/sb_1-13732982-1702568542.2358322/rpm/BUILD/mysql-8.3.0/mysql-8.3.0/sql/dd/impl/raw/raw_record.cc:158: bool dd::Raw_record::store(int, const dd::String_type&, bool): Assertion `rc == TYPE_OK' failed.
2024-02-01T19:00:27Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=5d614b2e802b33a33230d11eedcdc03f7171e041
Thread pointer: 0x7f2980000c10
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f2a2c2eaa90 thread_stack 0x100000
 #0 0x35a3b1a _Z18print_fatal_signali at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/signal_handler.cc:154
 #1 0x35a3cfc handle_fatal_signal at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/signal_handler.cc:230
 #2 0x7f2a4423ddaf <unknown>
 #3 0x7f2a4428a43c <unknown>
 #4 0x7f2a4423dd05 <unknown>
 #5 0x7f2a442107d2 <unknown>
 #6 0x7f2a442106fa <unknown>
 #7 0x7f2a44236c85 <unknown>
 #8 0x44342e9 _ZN2dd10Raw_record5storeEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcE19Stateless_allocatorIcNS_17String_type_allocE15My_free_functorEEEb at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/raw/raw_record.cc:158
 #9 0x448efcf _ZN2dd11Column_impl16store_attributesEPNS_10Raw_recordE at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/types/column_impl.cc:306
 #10 0x44c63ea _ZN2dd17Weak_object_impl_ILb1EE5storeEPNS_26Open_dictionary_tables_ctxE at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/types/weak_object_impl.cc:122
 #11 0x42e18a7 <unknown>
 #12 0x4488b51 _ZN2dd19Abstract_table_impl14store_childrenEPNS_26Open_dictionary_tables_ctxE at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/types/abstract_table_impl.cc:129
 #13 0x44b256e _ZN2dd10Table_impl14store_childrenEPNS_26Open_dictionary_tables_ctxE at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/types/table_impl.cc:367
 #14 0x44c64dc _ZN2dd17Weak_object_impl_ILb1EE5storeEPNS_26Open_dictionary_tables_ctxE at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/types/weak_object_impl.cc:152
 #15 0x443103b _ZN2dd5cache15Storage_adapter5storeINS_5TableEEEbP3THDPT_ at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/dd/impl/cache/storage_adapter.cc:334
 #16 0x4397071 <unknown>
 #17 0x34981be rea_create_base_table at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_table.cc:1120
 #18 0x34abb7c create_table_impl at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_table.cc:9020
 #19 0x34ac39b _Z26mysql_create_table_no_lockP3THDPKcS2_P14HA_CREATE_INFOP10Alter_infojbPbPP10handlerton at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_table.cc:9261
 #20 0x34ac9da _Z18mysql_create_tableP3THDP9Table_refP14HA_CREATE_INFOP10Alter_info at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_table.cc:10178
 #21 0x395ea0d _ZN20Sql_cmd_create_table7executeEP3THD at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_cmd_ddl_table.cc:459
 #22 0x33f9906 _Z21mysql_execute_commandP3THDb at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_parse.cc:3579
 #23 0x33fd45e _Z20dispatch_sql_commandP3THDP12Parser_state at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_parse.cc:5301
 #24 0x33febb1 _Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_parse.cc:2133
 #25 0x340018c _Z10do_commandP3THD at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/sql_parse.cc:1462
 #26 0x3593831 handle_connection at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/sql/conn_handler/connection_handler_per_thread.cc:303
 #27 0x4e1a787 pfs_spawn_thread at /usr/src/debug/mysql-community-8.3.0-1.el9.x86_64/mysql-8.3.0/storage/perfschema/pfs.cc:3050
 #28 0x7f2a442886d1 <unknown>
 #29 0x7f2a442283ef <unknown>
 #30 0xffffffffffffffff <unknown>

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f29806eb2c0): CREATE TABLE gts1.tt13 ( primary_key_column_000000001 BIGINT UNSIGNED AUTO_INCREMENT UNIQUE, __col1 DECIMAL(8,3) NOT NULL, __col2 MULTIPOLYGON SRID 0 DEFAULT (LAST_DAY(ST_MPolyFromText('MULTIPOLYGON((( -21 131, -47 -132, 26 -55, -21 131)),(( 29 -104, 20 61, -60 4, 29 -104)),(( -33 8, 83 -136, -11 -78, 42 -79, 3 140, -54 -93, -51 -113, 28 -170, 67 116, -68 54, -22 -130, 75 -56, -8 36, 79 159, -58 100, 29 -35, 62 134, -23 -109, -7 -105, 54 -147, 56 151, 72 59, 70 78, -36 143, 16 -3, -46 116, -52 -117, -62 -8, 22 -129, 63 -177, 1 -46, -21 -134, 56 -63, 35 116, 11 15, 90 13, 34 111, 17 152, 80 108, 72 23, -79 -152, -83 -171, -10 -64, 85 177, -86 122, 86 -114, 75 -32, 85 -44, -29 86, -57 40, 18 118, 82 12, 32 163, -39 67, 17 -179, -38 -90, -57 -83, -32 154, -85 -163, 0 -88, -34 96, 9 168, -80 48, 13 27, 77 -83, 72 144, 38 -125, -15 88, -63 -131, -58 18, -36 120, 4 21, -12 -141, -74 -22, 76 20, -55 -64, 41 -101, -2 30, -72 66, 48 90, 81 -166, 5 -39, 58 -145, 28 176, 73 88, 27 -97, -25 -99, -33 -12, -2 96, 5 9, 35 1
Connection ID (thread ID): 9
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file

In a non-debugging mysqld 8.3.0 build: 

instead of the crash I got

ERROR: 3507 (HY000): Failed to update columns dictionary object.

better but not too helpful, either
[2 Feb 1:42] Mikhail Izioumtchenko
non debugging 8.3.0: remove JSON column test_3_column_abc123defaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
then the table is successfully created.
It can be also created if DEFAULT for the JSON column is removed.
Also, if a more conventional DEFAULT OF '{}' is used then I got a meaningful message

ERROR: 1101 (42000): BLOB, TEXT, GEOMETRY or JSON column 'test_3_column_abc123defaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' can't have a default value
[2 Feb 9:02] MySQL Verification Team
Hello Mikhail,

Thank you for the report and feedback.
Observed that even 8.0.36 debug build affected.

regards,
Umesh
[2 Feb 9:03] MySQL Verification Team
- 8.0.36 debug build (113860.sql

 bin/mysql -uroot -S /tmp/mysql.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.36-debug MySQL Community Server - GPL - Debug

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database gts1;
Query OK, 1 row affected (0.01 sec)

mysql> source bugct.sql;
Query OK, 0 rows affected, 1 warning (0.00 sec)

ERROR 2013 (HY000): Lost connection to MySQL server during query

-bt

#0  0x00007f32710d6aa1 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000040303c2 in my_write_core(int) ()
#2  0x00000000032d6bc6 in handle_fatal_signal ()
#3  <signal handler called>
#4  0x00007f326f421387 in raise () from /lib64/libc.so.6
#5  0x00007f326f422a78 in abort () from /lib64/libc.so.6
#6  0x00007f326f41a1a6 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f326f41a252 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000003f58014 in dd::Raw_record::store(int, std::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool) ()
#9  0x0000000003fb49bc in dd::Column_impl::store_attributes(dd::Raw_record*) ()
#10 0x0000000003fe58fc in dd::Weak_object_impl_<true>::store(dd::Open_dictionary_tables_ctx*) ()
#11 0x0000000003e35aa7 in dd::Collection<dd::Column*>::store_items(dd::Open_dictionary_tables_ctx*) ()
#12 0x0000000003faf3f0 in dd::Abstract_table_impl::store_children(dd::Open_dictionary_tables_ctx*) ()
#13 0x0000000003fd43df in dd::Table_impl::store_children(dd::Open_dictionary_tables_ctx*) ()
#14 0x0000000003fe59ea in dd::Weak_object_impl_<true>::store(dd::Open_dictionary_tables_ctx*) ()
#15 0x0000000003f5531c in bool dd::cache::Storage_adapter::store<dd::Table>(THD*, dd::Table*) ()
#16 0x0000000003ed4faf in bool dd::cache::Dictionary_client::store<dd::Table>(dd::Table*) ()
#17 0x00000000031f0b92 in rea_create_base_table(THD*, char const*, dd::Schema const&, char const*, char const*, HA_CREATE_INFO*, List<Create_field>&, unsigned int, KEY*, Alter_info::enum_enable_or_disable, unsigned int, FOREIGN_KEY*, Mem_root_array<Sql_check_constraint_spec*> const*, handler*, bool, bool, partition_info*, bool*, std::unique_ptr<dd::Table, std::default_delete<dd::Table> >*, handlerton**) ()
#18 0x0000000003202ef7 in create_table_impl(THD*, dd::Schema const&, char const*, char const*, char const*, char const*, HA_CREATE_INFO*, Alter_info*, bool, unsigned int, bool, bool, bool, bool*, KEY**, unsigned int*, Alter_info::enum_enable_or_disable, FOREIGN_KEY**, unsigned int*, FOREIGN_KEY*, unsigned int, dd::Table const*, unsigned int, std::unique_ptr<dd::Table, std::default_delete<dd::Table> >*, handlerton**) ()
#19 0x0000000003203633 in mysql_create_table_no_lock(THD*, char const*, char const*, HA_CREATE_INFO*, Alter_info*, unsigned int, bool, bool*, handlerton**) ()
#20 0x0000000003203c0e in mysql_create_table(THD*, Table_ref*, HA_CREATE_INFO*, Alter_info*) ()
#21 0x00000000036149ee in Sql_cmd_create_table::execute(THD*) ()
#22 0x00000000031630ec in mysql_execute_command(THD*, bool) ()
#23 0x00000000031669ef in dispatch_sql_command(THD*, Parser_state*) ()
#24 0x0000000003168022 in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()
#25 0x0000000003169cb9 in do_command(THD*) ()
#26 0x00000000032c8bf0 in handle_connection ()
#27 0x00000000047f0b59 in pfs_spawn_thread ()
#28 0x00007f32710d1ea5 in start_thread () from /lib64/libpthread.so.0
#29 0x00007f326f4e9b2d in clone () from /lib64/libc.so.6