[MDEV-22422] Assertion `! is_set()' failed in Diagnostics_area::set_eof_status Created: 2020-04-30  Updated: 2021-05-20  Resolved: 2020-12-15

Status: Closed
Project: MariaDB Server
Component/s: Variables
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.2.37, 10.3.28, 10.4.18, 10.5.9

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Rucha Deodhar
Resolution: Fixed Votes: 1
Labels: affects-tests

Issue Links:
Relates
relates to MDEV-13011 Server crashes in THD::handle_conditi... Closed
relates to MDEV-13179 main.errors fails in buildbot and out... Closed
relates to MDEV-22708 Assertion `!mysql_bin_log.is_open() |... Closed
relates to MDEV-25735 Diagnostics_area::set_eof_status(THD*... Confirmed

 Description   

SET max_session_mem_used = 50000;
help 'it is going to crash';
help 'it is going to crash';
help 'it is going to crash';
help 'it is going to crash';
help 'it is going to crash';  # Crashes
help 'it crashed'; 

Leads to:

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

mysqld: /test/10.5_dbg/sql/sql_error.cc:375: void Diagnostics_area::set_eof_status(THD*): Assertion `! is_set()' failed.

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

Core was generated by `/test/MD210420-mariadb-10.5.3-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 0x7f8234e7c700 (LWP 561173))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055c78332903d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2  0x000055c782aced7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f82335c0801 in __GI_abort () at abort.c:79
#6  0x00007f82335b039a in __assert_fail_base (fmt=0x7f82337377d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55c7834972cd "! is_set()", file=file@entry=0x55c783497140 "/test/10.5_dbg/sql/sql_error.cc", line=line@entry=375, function=function@entry=0x55c783497c80 <Diagnostics_area::set_eof_status(THD*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_eof_status(THD*)") at assert.c:92
#7  0x00007f82335b0412 in __GI___assert_fail (assertion=assertion@entry=0x55c7834972cd "! is_set()", file=file@entry=0x55c783497140 "/test/10.5_dbg/sql/sql_error.cc", line=line@entry=375, function=function@entry=0x55c783497c80 <Diagnostics_area::set_eof_status(THD*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_eof_status(THD*)") at assert.c:101
#8  0x000055c7827da737 in Diagnostics_area::set_eof_status (this=0x7f820701ab88, thd=thd@entry=0x7f8207015088) at /test/10.5_dbg/sql/sql_error.cc:375
#9  0x000055c782c9bc95 in my_eof (thd=0x7f8207015088) at /test/10.5_dbg/sql/sql_class.h:5166
#10 mysqld_help_internal (thd=thd@entry=0x7f8207015088, mask=<optimized out>) at /test/10.5_dbg/sql/sql_help.cc:844
#11 0x000055c782c9c1bb in mysqld_help (thd=thd@entry=0x7f8207015088, mask=<optimized out>) at /test/10.5_dbg/sql/sql_help.cc:860
#12 0x000055c782824a58 in mysql_execute_command (thd=thd@entry=0x7f8207015088) at /test/10.5_dbg/sql/sql_parse.cc:3938
#13 0x000055c782831f2b in mysql_parse (thd=thd@entry=0x7f8207015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f8234e7b450, 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:7957
#14 0x000055c78281dc45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f8207015088, packet=packet@entry=0x7f8207067089 "", packet_length=packet_length@entry=27, 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:1839
#15 0x000055c78281c49b in do_command (thd=0x7f8207015088) at /test/10.5_dbg/sql/sql_parse.cc:1358
#16 0x000055c782977415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f8212fc53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
#17 0x000055c782977744 in handle_one_connection (arg=arg@entry=0x7f8212fc53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
#18 0x000055c782dd7fb0 in pfs_spawn_thread (arg=0x7f8232845b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#19 0x00007f82342a36db in start_thread (arg=0x7f8234e7c700) at pthread_create.c:463
#20 0x00007f82336a188f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.1.45 (dbg), 10.2.32 (dbg), 10.3.23 (dbg), 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.45 (opt), 10.2.32 (opt), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Roel Van de Paar [ 2020-04-30 ]

Another closely related issue in optimized builds (same testcase):

10.5.3>help 'it is going to crash';
ERROR 1290 (HY000): The MariaDB server is running with the --max-thread-mem-used=50000 option so it cannot execute this statement

Note the max-thread-mem-used vs max_session_mem_used

Could be a typo, variable name change without text update, or a different interaction between multiple variables. max_thread_mem_used is not listed in mysqld options nor online anywhere, so it looks like it is a typo or similar to be fixed.

Comment by Roel Van de Paar [ 2020-04-30 ]

Similar to previously closed bugs MDEV-13011 and MDEV-13179

Comment by Roel Van de Paar [ 2020-05-21 ]

Generic unique bug ID; may mask other bugs.

! is_set()|SIGABRT|Diagnostics_area::set_eof_status|my_eof|mysqld_help_internal|mysqld_help

Comment by Rucha Deodhar [ 2020-09-01 ]

I get a different stack trace leading to assertion failure:

Program terminated with signal SIGABRT, Aborted.

warning: Unexpected size of section `.reg-xstate/20826' in core file.
#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 0x7f5de1aee700 (LWP 20826))]
#0 __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1 0x00005609b4dd319d in my_write_core (sig=6) at /home/rucha/Workspace/10_1/server/mysys/stacktrace.c:387
#2 0x00005609b4783c67 in handle_fatal_signal (sig=6) at /home/rucha/Workspace/10_1/server/sql/signal_handler.cc:296
#3 <signal handler called>
#4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5 0x00007f5de79058b1 in __GI_abort () at abort.c:79
#6 0x00007f5de78f542a in _assert_fail_base (fmt=0x7f5de7a7ca38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5609b4f69cc0 "fixed == 1", file=file@entry=0x5609b4f6a0b0 "/home/rucha/Workspace/10_1/server/sql/item_cmpfunc.cc", line=line@entry=5222, function=function@entry=0x5609b4f6c360 <Item_func_like::val_int()::PRETTY_FUNCTION_> "virtual longlong Item_func_like::val_int()") at assert.c:92
#7 0x00007f5de78f54a2 in _GI_assert_fail (assertion=0x5609b4f69cc0 "fixed == 1", file=0x5609b4f6a0b0 "/home/rucha/Workspace/10_1/server/sql/item_cmpfunc.cc", line=5222, function=0x5609b4f6c360 <Item_func_like::val_int()::PRETTY_FUNCTION_> "virtual longlong Item_func_like::val_int()") at assert.c:101
#8 0x00005609b47c7a48 in Item_func_like::val_int (this=0x7f5dd014e7d8) at /home/rucha/Workspace/10_1/server/sql/item_cmpfunc.cc:5222
#9 0x00005609b48e4e96 in search_keyword (thd=0x5609b751c550, keywords=0x7f5dd0066880, find_fields=0x7f5de1aeb170, select=0x7f5dd014e928, key_id=0x7f5de1aeafc8) at /home/rucha/Workspace/10_1/server/sql/sql_help.cc:244
#10 0x00005609b48e65f5 in mysqld_help_internal (thd=0x5609b751c550, mask=0x7f5dd014d1a0 "it is going to crash") at /home/rucha/Workspace/10_1/server/sql/sql_help.cc:748
#11 0x00005609b48e6e54 in mysqld_help (thd=0x5609b751c550, mask=0x7f5dd014d1a0 "it is going to crash") at /home/rucha/Workspace/10_1/server/sql/sql_help.cc:857
#12 0x00005609b4545e3c in mysql_execute_command (thd=0x5609b751c550) at /home/rucha/Workspace/10_1/server/sql/sql_parse.cc:3061
#13 0x00005609b4552b6c in mysql_parse (thd=0x5609b751c550, rawbuf=0x7f5dd014d0d8 "help 'it is going to crash'", length=27, parser_state=0x7f5de1aed620) at /home/rucha/Workspace/10_1/server/sql/sql_parse.cc:7200
#14 0x00005609b4541d2d in dispatch_command (command=COM_QUERY, thd=0x5609b751c550, packet=0x5609b7522211 "help 'it is going to crash'", packet_length=27) at /home/rucha/Workspace/10_1/server/sql/sql_parse.cc:1491
#15 0x00005609b4540c19 in do_command (thd=0x5609b751c550) at /home/rucha/Workspace/10_1/server/sql/sql_parse.cc:1123
#16 0x00005609b467ec69 in do_handle_one_connection (thd_arg=0x5609b751c550) at /home/rucha/Workspace/10_1/server/sql/sql_connect.cc:1331
#17 0x00005609b467e9a4 in handle_one_connection (arg=0x5609b751c550) at /home/rucha/Workspace/10_1/server/sql/sql_connect.cc:1242
#18 0x00005609b4a9d0d5 in pfs_spawn_thread (arg=0x5609b75273a0) at /home/rucha/Workspace/10_1/server/storage/perfschema/pfs.cc:1868
#19 0x00007f5de83e46db in start_thread (arg=0x7f5de1aee700) at pthread_create.c:463
#20 0x00007f5de79e6a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
warning: Unexpected size of section `.reg-xstate/20818' in core file.

Comment by Roel Van de Paar [ 2020-11-03 ]

rucha174 any updates please?

Comment by Roel Van de Paar [ 2020-11-03 ]

SET SQL_MODE='';
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
HELP '%a';
CREATE TABLE t (c CHAR(8) NOT NULL) ENGINE=MEMORY;
SET max_session_mem_used = 50000;
REPLACE DELAYED t VALUES (5);
HELP 'a%';

Without --log-bin added to the startup, this testcase produces the same issue. With --log-bin added, it produces MDEV-22708.

Comment by Rucha Deodhar [ 2020-11-03 ]

Roel Yes, It crashes in the first search topics. I changed max_session_mem_used as suggested in the review to check if it can crash later because the code after first search_topics() looked fragile. Found out that it doesn't crash.

Comment by Rucha Deodhar [ 2020-11-03 ]

Patch: https://github.com/MariaDB/server/commit/9c2570e6c42

Comment by Sergei Golubchik [ 2020-11-11 ]

9c2570e6c42 is ok to push

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