Bug #115349 8.4LTS Assertion `MDL_checker::is_read_locked(m_thd, *object)' dictionary_client
Submitted: 16 Jun 19:27 Modified: 18 Jun 1:57
Reporter: Mikhail Izioumtchenko Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S6 (Debug Builds)
Version:8.4LTS-debug OS:Any
Assigned to: CPU Architecture:Any

[16 Jun 19:27] Mikhail Izioumtchenko
Description:
mysqld: /var/lib/pb2/sb_1-15015186-1712734669.6497831/rpm/BUILD/mysql-8.4.0/mysql-8.4.0/sql/dd/impl/cache/dictionary_client.cc:945: bool dd::cache::Dictionary_client::acquire(const K&, const T**, bool*, bool*) [with K = dd::Item_name_key; T = dd::Column_statistics]: Assertion `MDL_checker::is_read_locked(m_thd, *object)' failed.
2024-06-16T04:57:02Z UTC - mysqld got signal 6 ;

#9 0x4341a53 <unknown>
 #10 0x367861f _ZN10histograms14find_histogramEP3THDRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S9_PPKNS_9HistogramE at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/histograms/histogram.cc:2101
 #11 0x32aa288 read_histograms at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:680
 #12 0x32aed93 _Z15get_table_shareP3THDPKcS2_S2_mbb at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:904
 #13 0x32af1db get_table_share_with_discover at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:976
 #14 0x32b4e75 _Z10open_tableP3THDP9Table_refP18Open_table_context at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:3302
 #15 0x32b5c93 open_and_process_table at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:5147
 #16 0x32b627a _Z11open_tablesP3THDPP9Table_refPjjP19Prelocking_strategy at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:5969
 #17 0x32b7589 _Z21open_tables_for_queryP3THDP9Table_refj at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_base.cc:6916
 #18 0x33e9fde _ZN11Sql_cmd_dml7prepareEP3THD at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_select.cc:535
 #19 0x33ea4af _ZN11Sql_cmd_dml7executeEP3THD at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_select.cc:719
 #20 0x337dd65 _Z21mysql_execute_commandP3THDb at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_parse.cc:3670
 #21 0x33818b6 _Z20dispatch_sql_commandP3THDP12Parser_state at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_parse.cc:5392
 #22 0x3382fae _Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_parse.cc:2136
 #23 0x3384a0a _Z10do_commandP3THD at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/sql_parse.cc:1465
 #24 0x3518fad handle_connection at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/sql/conn_handler/connection_handler_per_thread.cc:304
 #25 0x4db706b pfs_spawn_thread at /usr/src/debug/mysql-community-8.4.0-1.el9.x86_64/mysql-8.4.0/storage/perfschema/pfs.cc:3051
 #26 0x7fedf5f47c11 <unknown>
 #27 0x7fedf5fcccbf <unknown>
 #28 0xffffffffffffffff <unknown>

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fed3862e8c0): INSERT into  gts3.tt1 (`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`added_col_3288`) VALUES ( 19395, 'stu9ef01', 'defghiy1212389AJKOPQRS4567lmnopcdmnEFGHjklEF9', RAND()*107, LAST_INSERT_ID(), 75, UTC_DATE, 'omnopq67JKLABCDDEFGH0RSQTUVWDEDAIJbcdefUVWXY89ABC12345IJwmnopDEF4567789qrsstu989MNOPmnoPQChijA1ABC012BCDEFTU9ABC4567875678qrsT223')

How to repeat:
reproducible, see attached .sql
[16 Jun 19:31] Mikhail Izioumtchenko
testcase

Attachment: b.sql (application/octet-stream, text), 2.50 MiB.

[17 Jun 9:56] MySQL Verification Team
Hello Mikhail,

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

Not sure what I'm missing but getting different asserts than your:

mysqld-debug: ../../mysql-8.4.0/sql/iterators/composite_iterators.cc:3596: int {anonymous}::SpillState::read_next_row_secondary_overflow(): Assertion `false' failed.
2024-06-17T09:52:26Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=3e4b90e3952d5b3d4d43026265252902fdc6e1cc
Thread pointer: 0x7f2ddc000da0
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 = 7f2e7c666b18 thread_stack 0x100000
 #0 0x335ea6d print_fatal_signal at mysql-8.4.0/sql/signal_handler.cc:319
 #1 0x335ec70 _Z19handle_fatal_signaliP9siginfo_tPv at mysql-8.4.0/sql/signal_handler.cc:399
 #2 0x7f2ea6f7762f <unknown>
 #3 0x7f2ea5149387 <unknown>
 #4 0x7f2ea514aa77 <unknown>
 #5 0x7f2ea51421a5 <unknown>
 #6 0x7f2ea5142251 <unknown>
 #7 0x3716602 read_next_row_secondary_overflow at mysql-8.4.0/sql/iterators/composite_iterators.cc:3596
 #8 0x37168c0 read_next_row at mysql-8.4.0/sql/iterators/composite_iterators.cc:3434
 #9 0x3716e2e read_next_row at mysql-8.4.0/sql/iterators/composite_iterators.cc:2276
 #10 0x371c373 MaterializeOperand at mysql-8.4.0/sql/iterators/composite_iterators.cc:2771
 #11 0x371cb8a Init at mysql-8.4.0/sql/iterators/composite_iterators.cc:1644
 #12 0x371c074 MaterializeOperand at mysql-8.4.0/sql/iterators/composite_iterators.cc:2759
 #13 0x371cb8a Init at mysql-8.4.0/sql/iterators/composite_iterators.cc:1644
 #14 0x371c074 MaterializeOperand at mysql-8.4.0/sql/iterators/composite_iterators.cc:2759
 #15 0x371cb8a Init at mysql-8.4.0/sql/iterators/composite_iterators.cc:1644
 #16 0x371c074 MaterializeOperand at mysql-8.4.0/sql/iterators/composite_iterators.cc:2759
 #17 0x371cb8a Init at mysql-8.4.0/sql/iterators/composite_iterators.cc:1644
 #18 0x32ad457 _ZN16Query_expression20ExecuteIteratorQueryEP3THD at mysql-8.4.0/sql/sql_union.cc:1771
 #19 0x32ad6cd _ZN16Query_expression7executeEP3THD at mysql-8.4.0/sql/sql_union.cc:1834
 #20 0x323c900 _ZN11Sql_cmd_dml13execute_innerEP3THD at mysql-8.4.0/sql/sql_select.cc:1059
 #21 0x323feb0 _ZN11Sql_cmd_dml7executeEP3THD at mysql-8.4.0/sql/sql_select.cc:782
 #22 0x31df0d9 _Z21mysql_execute_commandP3THDb at mysql-8.4.0/sql/sql_parse.cc:4737
 #23 0x31e056f _Z20dispatch_sql_commandP3THDP12Parser_state at mysql-8.4.0/sql/sql_parse.cc:5392
 #24 0x31e1c32 _Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command at mysql-8.4.0/sql/sql_parse.cc:2136
 #25 0x31e35c5 _Z10do_commandP3THD at mysql-8.4.0/sql/sql_parse.cc:1465
 #26 0x33507a9 handle_connection at mysql-8.4.0/sql/conn_handler/connection_handler_per_thread.cc:304
 #27 0x490b1f6 pfs_spawn_thread at mysql-8.4.0/storage/perfschema/pfs.cc:3051
 #28 0x7f2ea6f6fea4 <unknown>
 #29 0x7f2ea5211b2c <unknown>
 #30 0xffffffffffffffff <unknown>

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f2ddc06c5a0): SELECT col2,col8,col10,col11,col14,col16,col19,col21 FROM gts8.tt1  INTERSECT SELECT col2,col8,col10,col11,col14,col16,col19,col21 FROM gts8.tt1 WHERE  NOT RTRIM(col11) IS NOT NULL UNION ALL SELECT col2,col8,col10,col11,col14,col16,col19,col21 FROM gts8.tt1 WHERE TAN(col13) NOT LIKE ~'5678NOPQR6789i5678vwxyzSTU789012OPQRSX'  EXCEPT ALL SELECT col2,col8,col10,col11,col14,col16,col19,col21 FROM gts8.tt1 WHERE  NOT col14 < -col6 *  -136  UNION ALL SELECT col2,col8,col10,col11,col14,col16,col19,col21 FROM gts8.tt1 WHERE  NOT 10250 >>  ASIN(col6) ^  ~63 DIV  14061 +  -1 ^  -1 %  ~45 ^  ~CEIL(col17) +  col12 IS NULL UNION SELECT col2,col8,col10,col11,col14,col16,col19,col21 FROM gts8.tt1 WHERE ~'4BCDEabM23fgzbcd6789u9ABCDBCDEFklmz012hz0123RSTUVMNOPlmnokxjK45678pJKLMN123KEFGHI7bcdeftui5678rstuMNOPLMNuvcde' <=> 'X60123noGHI67FGHIJ012356'  XOR ~0.334152877206186E9 IS NOT NULL XOR 'efghCDEmntuvXYZ231rstuv12ijklmklQ45676opqrsHtpqrsJKrstu567strstuOP67012Q9ABC3NOPQRBCDExyz0458IJ56FGHZ01fvwxyFGHIwxyz0ABCDESTUVWpqDEEFGDEFGZ
Connection ID (thread ID): 8
Status: NOT_KILLED

regards,
Umesh
[18 Jun 1:48] Mikhail Izioumtchenko
I have also seen the `false` assert though I don't remember having a simple testcase for that. I'll doublecheck my .sql files

2024-06-14: Also happens in 8.4. Correlated with using SELECT ... UNION/INTERSECT
https://bugs.mysql.com/bug.php?id=115346 mysql-8.3.0/sql/iterators/composite_iterators.cc:2970: int materialize_iterator::SpillState::read_next_row_secondary_overflow(): Assertion `false' failed.
[18 Jun 1:57] Mikhail Izioumtchenko
I consistently have the `MDL_checker assertion with the file I uploaded.
For `false` the workaround was to limit SELECT X SELECT to X=UNION avoiding INTERSECT and EXCEPT