[MDEV-24179] Assertion `m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK' failed in Diagnostics_area::message() Created: 2020-11-09  Updated: 2021-04-28  Resolved: 2021-01-19

Status: Closed
Project: MariaDB Server
Component/s: Views
Affects Version/s: 10.2.34, 10.3.25, 10.4.15, 10.5.6, 10.6.0
Fix Version/s: 10.2.37, 10.3.28, 10.4.18, 10.5.9

Type: Bug Priority: Major
Reporter: Stepan Patryshev (Inactive) Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: None

Attachments: File master.err    
Issue Links:
Relates
relates to MDEV-14836 Assertion `m_status == DA_ERROR' fail... Closed

 Description   

DROP DATABASE test;
CREATE DATABASE test;
USE test;
CREATE VIEW v AS SELECT table_schema  AS object_schema, table_name  AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
SELECT * FROM v LIMIT ROWS EXAMINED 9;

Sporadically (it needs about 100 repeats to reproduce) leads to:

10.5.8 4cbfdeca840098b9ed0d8147d43288c36743a328 (Debug)

mysqld: /test/10.5_dbg/sql/sql_error.h:1023: const char* Diagnostics_area::message() const: Assertion `m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK' failed.

10.5.8 4cbfdeca840098b9ed0d8147d43288c36743a328 (Debug)

Core was generated by `/test/MD041120-mariadb-10.5.8-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14e2fd9b2700 (LWP 2834984))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x00005594dae3bfb4 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:424
#2  0x00005594da6127ad in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x000014e31507d8b1 in __GI_abort () at abort.c:79
#6  0x000014e31506d42a in __assert_fail_base (fmt=0x14e3151f4a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5594daf96af8 "m_status == DA_E
RROR || m_status == DA_OK || m_status == DA_OK_BULK", file=file@entry=0x5594daf96b40 "/test/10.5_dbg/sql/sql_error.h", line=line@entry=1023, function=function@entry=0x5
594dafa0c80 <_ZZNK16Diagnostics_area7messageEvE19__PRETTY_FUNCTION__> "const char* Diagnostics_area::message() const") at assert.c:92
#7  0x000014e31506d4a2 in __GI___assert_fail (assertion=assertion@entry=0x5594daf96af8 "m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK", file=file@
entry=0x5594daf96b40 "/test/10.5_dbg/sql/sql_error.h", line=line@entry=1023, function=function@entry=0x5594dafa0c80 <_ZZNK16Diagnostics_area7messageEvE19__PRETTY_FUNCTI
ON__> "const char* Diagnostics_area::message() const") at assert.c:101
#8  0x00005594da28eb80 in Diagnostics_area::message (this=0x14e2d0006a00) at /test/10.5_dbg/sql/sql_error.h:1022
#9  0x00005594da40081d in get_schema_tables_record (thd=0x14e2d0000d78, tables=<optimized out>, table=0x14e2d0023bf0, res=<optimized out>, db_name=<optimized out>, tabl
e_name=<optimized out>) at /test/10.5_dbg/sql/sql_show.cc:5690
#10 0x00005594da3f4e3a in fill_schema_table_by_open (thd=thd@entry=0x14e2d0000d78, mem_root=mem_root@entry=0x14e2fd9aee20, is_show_fields_or_keys=is_show_fields_or_keys
@entry=false, table=table@entry=0x14e2d0023bf0, schema_table=schema_table@entry=0x5594dbaede00 <schema_tables+2048>, orig_db_name=orig_db_name@entry=0x14e2d00520f0, ori
g_table_name=0x14e2d0053338, open_tables_state_backup=0x14e2fd9aee60, can_deadlock=true) at /test/10.5_dbg/sql/sql_show.cc:4641
#11 0x00005594da40b1a5 in get_all_tables (thd=0x14e2d0000d78, tables=0x14e2d0016a18, cond=<optimized out>) at /test/10.5_dbg/sql/sql_show.cc:5245
#12 0x00005594da40c4dc in get_schema_tables_result (join=join@entry=0x14e2d0018220, executed_place=executed_place@entry=PROCESSED_BY_JOIN_EXEC) at /test/10.5_dbg/sql/sq
l_show.cc:8698
#13 0x00005594da3df391 in JOIN::exec_inner (this=this@entry=0x14e2d0018220) at /test/10.5_dbg/sql/sql_select.cc:4416
#14 0x00005594da3dfd39 in JOIN::exec (this=this@entry=0x14e2d0018220) at /test/10.5_dbg/sql/sql_select.cc:4240
#15 0x00005594da3de084 in mysql_select (thd=thd@entry=0x14e2d0000d78, tables=0x14e2d0012f70, fields=@0x14e2d0012ad0: {<base_list> = {<Sql_alloc> = {<No data fields>}, f
irst = 0x14e2d0012f28, last = 0x14e2d0042870, elements = 3}, <No data fields>}, conds=0x0, og_num=1, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, selec
t_options=2147748608, result=0x14e2d00181f8, unit=0x14e2d0004f18, select_lex=0x14e2d0012980) at /test/10.5_dbg/sql/sql_select.cc:4655
#16 0x00005594da3de348 in handle_select (thd=thd@entry=0x14e2d0000d78, lex=lex@entry=0x14e2d0004e50, result=result@entry=0x14e2d00181f8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
#17 0x00005594da364b14 in execute_sqlcom_select (thd=thd@entry=0x14e2d0000d78, all_tables=0x14e2d0012f70) at /test/10.5_dbg/sql/sql_parse.cc:6266
#18 0x00005594da35db44 in mysql_execute_command (thd=thd@entry=0x14e2d0000d78) at /test/10.5_dbg/sql/sql_parse.cc:3968
#19 0x00005594da36aa98 in mysql_parse (thd=thd@entry=0x14e2d0000d78, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14e2fd9b1390, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8044
#20 0x00005594da3573af in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e2d0000d78, packet=packet@entry=0x14e2d0008f49 "SELECT * FROM v LIMIT ROWS EXAMINED 9", packet_length=packet_length@entry=37, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1872
#21 0x00005594da355b99 in do_command (thd=0x14e2d0000d78) at /test/10.5_dbg/sql/sql_parse.cc:1353
#22 0x00005594da4b66ef in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5594dee74ac8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
#23 0x00005594da4b6e13 in handle_one_connection (arg=arg@entry=0x5594dee74ac8) at /test/10.5_dbg/sql/sql_connect.cc:1312
#24 0x00005594da922ab2 in pfs_spawn_thread (arg=0x5594ded9de28) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#25 0x000014e315d606db in start_thread (arg=0x14e2fd9b2700) at pthread_create.c:463
#26 0x000014e31515ea3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.2.34 (dbg), 10.2.36 (dbg), 10.3.25 (dbg), 10.3.27 (dbg), 10.4.15 (dbg), 10.4.17 (dbg), 10.5.6 (dbg), 10.5.8 (dbg), 10.6.0 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.47 (dbg), 10.1.47 (opt), 10.1.49 (dbg), 10.1.49 (opt), 10.2.34 (opt), 10.2.36 (opt), 10.3.25 (opt), 10.3.27 (opt), 10.4.15 (opt), 10.4.17 (opt), 10.5.6 (opt), 10.5.8 (opt), 10.6.0 (opt)

Server log.
Core files.



 Comments   
Comment by Rucha Deodhar [ 2020-12-18 ]

Patch: https://github.com/MariaDB/server/commit/ab7092a415f11787d10fa25f387fe9c1c272ff46

Comment by Sergei Golubchik [ 2021-01-19 ]

commit ab7092a415f is ok to push

Comment by Rucha Deodhar [ 2021-01-19 ]

Same patch as the previous.
The assertion failure is happening right before fill_schema_table_by_open() after maximum limit to examine rows is reached, so the if statement can't be moved.

Generated at Thu Feb 08 09:28:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.