Bug #83797 Assertion `! is_set() || m_can_overwrite_status' failed.
Submitted: 14 Nov 2016 2:22 Modified: 15 Nov 2016 4:45
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:5.6.34, 5.7.16 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[14 Nov 2016 2:22] Roel Van de Paar
Description:
Version: '5.6.34-debug'  socket: '/sda/MS081116-mysql-5.6.34-linux-x86_64-debug/socket.sock'  port: 11652  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/sql/sql_error.cc:521: void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_condition*): Assertion `! is_set() || m_can_overwrite_status' failed.
02:03:22 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS081116-mysql-5.6.34-linux-x86_64-debug/bin/mysqld --no-defaults --core -'.
Program terminated with signal 6, Aborted.
#0  0x00007f552b413741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007f552b413741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000a9c852 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:422
#2  0x000000000072c554 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007f55299b25f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f55299b3ce8 in __GI_abort () at abort.c:90
#6  0x00007f55299ab566 in __assert_fail_base (fmt=0x7f5529afbce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0xe7e890 "! is_set() || m_can_overwrite_status", file=file@entry=0xe7e688 "/git/mysql-server_dbg/sql/sql_error.cc", line=line@entry=521,
    function=function@entry=0xe7ecc0 <Diagnostics_area::set_error_status(unsigned int, char const*, char const*, Sql_condition const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_condition*)") at assert.c:92
#7  0x00007f55299ab612 in __GI___assert_fail (assertion=0xe7e890 "! is_set() || m_can_overwrite_status", file=0xe7e688 "/git/mysql-server_dbg/sql/sql_error.cc", line=521,
    function=0xe7ecc0 <Diagnostics_area::set_error_status(unsigned int, char const*, char const*, Sql_condition const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_condition*)") at assert.c:101
#8  0x00000000007a5946 in Diagnostics_area::set_error_status (this=0x7f5502b8a030, sql_errno=5, message=0x7f552ba06db0 "Out of memory (Needed 32 bytes)",
    sqlstate=0xe96ce1 "HY000", error_condition=0x0) at /git/mysql-server_dbg/sql/sql_error.cc:521
#9  0x000000000078ee13 in THD::raise_condition (this=0x7f5502b87000, sql_errno=5, sqlstate=0xe96ce1 "HY000", level=Sql_condition::WARN_LEVEL_ERROR,
    msg=0x7f552ba06db0 "Out of memory (Needed 32 bytes)") at /git/mysql-server_dbg/sql/sql_class.cc:1297
#10 0x0000000000624cca in my_message_sql (error=5, str=0x7f552ba06db0 "Out of memory (Needed 32 bytes)", MyFlags=1124) at /git/mysql-server_dbg/sql/mysqld.cc:3331
#11 0x0000000000a937e5 in my_error (nr=5, MyFlags=1124) at /git/mysql-server_dbg/mysys/my_error.c:185
#12 0x0000000000a96ae5 in my_malloc (size=32, my_flags=16) at /git/mysql-server_dbg/mysys/my_malloc.c:56
#13 0x0000000000e031b9 in initialize_bucket (hash=0x1754b40 <digest_hash>, node=0x7f54f644dca0, bucket=1107, pins=0x7f54f6424080) at /git/mysql-server_dbg/mysys/lf_hash.c:479
#14 0x0000000000e03123 in lf_hash_search (hash=0x1754b40 <digest_hash>, pins=0x7f54f6424080, key=0x7f552ba071c0, keylen=212) at /git/mysql-server_dbg/mysys/lf_hash.c:460
#15 0x0000000000ab9d66 in find_or_create_digest (thread=0x7f55169bec00, digest_storage=0x7f5502b88978, schema_name=0x7f5502b88a60 "test", schema_name_length=0)
    at /git/mysql-server_dbg/storage/perfschema/pfs_digest.cc:223
#16 0x0000000000aeed35 in end_statement_v1 (locker=0x7f5502b889b8, stmt_da=0x7f5502b8a030) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:4815
#17 0x00000000007d29d1 in inline_mysql_end_statement (locker=0x7f5502b889b8, stmt_da=0x7f5502b8a030) at /git/mysql-server_dbg/include/mysql/psi/mysql_statement.h:215
#18 0x00000000007d7529 in dispatch_command (command=COM_QUERY, thd=0x7f5502b87000, packet=0x7f5502b6b001 "", packet_length=44) at /git/mysql-server_dbg/sql/sql_parse.cc:1783
#19 0x00000000007d5016 in do_command (thd=0x7f5502b87000) at /git/mysql-server_dbg/sql/sql_parse.cc:1036
#20 0x000000000079c9a5 in do_handle_one_connection (thd_arg=0x7f5502b87000) at /git/mysql-server_dbg/sql/sql_connect.cc:982
#21 0x000000000079c48e in handle_one_connection (arg=0x7f5502b87000) at /git/mysql-server_dbg/sql/sql_connect.cc:898
#22 0x0000000000ae8ac9 in pfs_spawn_thread (arg=0x7f550e7896a0) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:1860
#23 0x00007f552b40edc5 in start_thread (arg=0x7f552ba08700) at pthread_create.c:308
#24 0x00007f5529a73ced in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;
SET GLOBAL debug='+d,simulate_out_of_memory';
[14 Nov 2016 5:59] Roel Van de Paar
SET LOCAL log_slow_verbosity='profiling';
SET GLOBAL debug='+d,simulate_out_of_memory';
[14 Nov 2016 6:06] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.6.34/5.7.16 debug builds are affected.

Thanks,
Umesh
[14 Nov 2016 6:07] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.6.34/5.7.16 debug builds are affected.

Thanks,
Umesh
[15 Nov 2016 4:44] Roel Van de Paar
DROP DATABASE test;
set session profiling=ON;
SET GLOBAL debug='+d,simulate_out_of_memory';

Different crash, likely same cause

(gdb) bt
#0  0x00007f733017d741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000a9c852 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:422
#2  0x000000000072c554 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007f732e71c5f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f732e71dce8 in __GI_abort () at abort.c:90
#6  0x00007f732e715566 in __assert_fail_base (fmt=0x7f732e865ce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0xe8ec60 "allocated_status_memory != __null", file=file@entry=0xe8ec30 "/git/mysql-server_dbg/sql/sql_profile.cc", line=line@entry=204,
    function=function@entry=0xe8efc0 <PROF_MEASUREMENT::set_label(char const*, char const*, char const*, unsigned int)::__PRETTY_FUNCTION__> "void PROF_MEASUREMENT::set_label(const char*, const char*, const char*, unsigned int)") at assert.c:92
#7  0x00007f732e715612 in __GI___assert_fail (assertion=0xe8ec60 "allocated_status_memory != __null", file=0xe8ec30 "/git/mysql-server_dbg/sql/sql_profile.cc", line=204,
    function=0xe8efc0 <PROF_MEASUREMENT::set_label(char const*, char const*, char const*, unsigned int)::__PRETTY_FUNCTION__> "void PROF_MEASUREMENT::set_label(const char*, const char*, const char*, unsigned int)") at assert.c:101
#8  0x00000000007fc25d in PROF_MEASUREMENT::set_label (this=0x7f72fb00e480, status_arg=0xe48ca1 "query end",
    function_arg=0xe8b520 <mysql_execute_command(THD*)::__FUNCTION__> "mysql_execute_command", file_arg=0xe89aca "sql_parse.cc", line_arg=4995)
    at /git/mysql-server_dbg/sql/sql_profile.cc:204
#9  0x00000000007fc125 in PROF_MEASUREMENT::PROF_MEASUREMENT (this=0x7f72fb00e480, profile_arg=0x7f72fb07b0b0, status_arg=0xe48ca1 "query end",
    function_arg=0xe8b520 <mysql_execute_command(THD*)::__FUNCTION__> "mysql_execute_command", file_arg=0xe89aca "sql_parse.cc", line_arg=4995)
    at /git/mysql-server_dbg/sql/sql_profile.cc:179
#10 0x00000000007fc631 in QUERY_PROFILE::new_status (this=0x7f72fb07b0b0, status_arg=0xe48ca1 "query end",
    function_arg=0xe8b520 <mysql_execute_command(THD*)::__FUNCTION__> "mysql_execute_command", file_arg=0xe89ab0 "/git/mysql-server_dbg/sql/sql_parse.cc", line_arg=4995)
    at /git/mysql-server_dbg/sql/sql_profile.cc:304
#11 0x00000000007fc88b in PROFILING::status_change (this=0x7f7307788920, status_arg=0xe48ca1 "query end",
    function_arg=0xe8b520 <mysql_execute_command(THD*)::__FUNCTION__> "mysql_execute_command", file_arg=0xe89ab0 "/git/mysql-server_dbg/sql/sql_parse.cc", line_arg=4995)
    at /git/mysql-server_dbg/sql/sql_profile.cc:357
#12 0x000000000078cda4 in THD::enter_stage (this=0x7f7307787000, new_stage=0x142c410 <stage_query_end>, old_stage=0x0,
    calling_func=0xe8b520 <mysql_execute_command(THD*)::__FUNCTION__> "mysql_execute_command", calling_file=0xe89ab0 "/git/mysql-server_dbg/sql/sql_parse.cc", calling_line=4995)
    at /git/mysql-server_dbg/sql/sql_class.cc:626
#13 0x00000000007dfa33 in mysql_execute_command (thd=0x7f7307787000) at /git/mysql-server_dbg/sql/sql_parse.cc:4995
#14 0x00000000007e2d7e in mysql_parse (thd=0x7f7307787000, rawbuf=0x7f72fb01f010 "SET GLOBAL debug='+d,simulate_out_of_memory'", length=44, parser_state=0x7f73307715a0)
    at /git/mysql-server_dbg/sql/sql_parse.cc:6385
#15 0x00000000007d5faf in dispatch_command (command=COM_QUERY, thd=0x7f7307787000, packet=0x7f730776b001 "SET GLOBAL debug='+d,simulate_out_of_memory'", packet_length=44)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1339
#16 0x00000000007d5016 in do_command (thd=0x7f7307787000) at /git/mysql-server_dbg/sql/sql_parse.cc:1036
#17 0x000000000079c9a5 in do_handle_one_connection (thd_arg=0x7f7307787000) at /git/mysql-server_dbg/sql/sql_connect.cc:982
#18 0x000000000079c48e in handle_one_connection (arg=0x7f7307787000) at /git/mysql-server_dbg/sql/sql_connect.cc:898
#19 0x0000000000ae8ac9 in pfs_spawn_thread (arg=0x7f73133896a0) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:1860
#20 0x00007f7330178dc5 in start_thread (arg=0x7f7330772700) at pthread_create.c:308
#21 0x00007f732e7ddced in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
[15 Nov 2016 4:45] Roel Van de Paar
For that last comment, the error log shows;

2016-11-15 15:24:49 17303 [Note] /sda/MS081116-mysql-5.6.34-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.6.34-debug'  socket: '/sda/MS081116-mysql-5.6.34-linux-x86_64-debug/socket.sock'  port: 11652  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/sql/sql_profile.cc:204: void PROF_MEASUREMENT::set_label(const char*, const char*, const char*, unsigned int): Assertion `allocated_status_memory != __null' failed.
04:24:54 UTC - mysqld got signal 6 ;
[15 Nov 2016 7:27] MySQL Verification Team
Bug #74026 marked as duplicate of this