Bug #91847 Assertion `thread_ids.empty()' failed.
Submitted: 1 Aug 2:56 Modified: 14 Aug 17:58
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S2 (Serious)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[1 Aug 2:56] Roel Van de Paar
Description:
mysqld: /git/MS-8.0.12_dbg/sql/mysqld_thd_manager.cc:172: Global_THD_manager::~Global_THD_manager(): Assertion `thread_ids.empty()' failed.

Core was generated by `/sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
Program terminated with signal SIGABRT, Aborted.
#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.
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055b9457a878d in my_write_core (sig=6)
    at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055b9444fcd94 in handle_fatal_signal (sig=6)
    at /git/MS-8.0.12_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f77f5b35801 in __GI_abort () at abort.c:79
#6  0x00007f77f5b2539a in __assert_fail_base (
    fmt=0x7f77f5cac7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55b946106d40 "thread_ids.empty()", 
    file=file@entry=0x55b946106cb8 "/git/MS-8.0.12_dbg/sql/mysqld_thd_manager.cc", 
    line=line@entry=172, 
    function=function@entry=0x55b946106f00 <Global_THD_manager::~Global_THD_manager()::__PRETTY_FUNCTION__> "Global_THD_manager::~Global_THD_manager()") at assert.c:92
#7  0x00007f77f5b25412 in __GI___assert_fail (
    assertion=0x55b946106d40 "thread_ids.empty()", 
    file=0x55b946106cb8 "/git/MS-8.0.12_dbg/sql/mysqld_thd_manager.cc", line=172, 
    function=0x55b946106f00 <Global_THD_manager::~Global_THD_manager()::__PRETTY_FUNCTION__> "Global_THD_manager::~Global_THD_manager()") at assert.c:101
#8  0x000055b94420981b in Global_THD_manager::~Global_THD_manager (
    this=0x7f77e3bfd000, __in_chrg=<optimized out>)
    at /git/MS-8.0.12_dbg/sql/mysqld_thd_manager.cc:172
#9  0x000055b944209926 in Global_THD_manager::destroy_instance ()
    at /git/MS-8.0.12_dbg/sql/mysqld_thd_manager.cc:187
#10 0x000055b9441e73e8 in clean_up (print_message=true)
    at /git/MS-8.0.12_dbg/sql/mysqld.cc:2053
#11 0x000055b9441e6b02 in unireg_abort (exit_code=1)
    at /git/MS-8.0.12_dbg/sql/mysqld.cc:1869
#12 0x000055b9441f0b8b in init_server_components ()
    at /git/MS-8.0.12_dbg/sql/mysqld.cc:5048
#13 0x000055b9441f466e in mysqld_main (argc=11, argv=0x7f77f5046120)
    at /git/MS-8.0.12_dbg/sql/mysqld.cc:5917
#14 0x000055b9441e3b9a in main (argc=11, argv=0x7ffd61cbf378)
    at /git/MS-8.0.12_dbg/sql/main.cc:30

How to repeat:
--thread-stack=1125899906842624
[1 Aug 2:58] Roel Van de Paar
5.7.12 gives:

2018-08-01T02:57:11.619638Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180801 12:57:11
2018-08-01T02:57:11.680886Z 0 [Note] Event Scheduler: Loaded 0 events
2018-08-01T02:57:11.680984Z 0 [ERROR] Can't create interrupt-thread (error 11, errno: 12)

Then hangs
[1 Aug 2:59] Roel Van de Paar
On closer checking, 8.0.12 also gives interesting errors;

2018-08-01T02:20:04.987881Z 0 [System] [MY-010116] [Server] /sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld (mysqld 8.0.12-debug) starting as process 9263
2018-08-01T02:20:05.027430Z 0 [Warning] [MY-010001] [Server] Can't create thread to handle bootstrap (errno: 12)
2018-08-01T02:20:05.027502Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2018-08-01T02:20:05.027519Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-08-01T02:20:05.028118Z 0 [Warning] [MY-010738] [Server] Plugin 'MyISAM' will be forced to shutdown
2018-08-01T02:20:05.028282Z 0 [ERROR] [MY-010739] [Server] Plugin 'MyISAM' has ref_count=2 after shutdown.
2018-08-01T02:20:05.028500Z 0 [System] [MY-010910] [Server] /sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld: Shutdown complete (mysqld 8.0.12-debug)  MySQL Community Server (GPL).
mysqld: /git/MS-8.0.12_dbg/sql/mysqld_thd_manager.cc:172: Global_THD_manager::~Global_THD_manager(): Assertion `thread_ids.empty()' failed.
02:20:05 UTC - mysqld got signal 6 ;
[1 Aug 5:56] Umesh Shastry
Hello Roel,

Thank you for the report.

regards,
umesh
[14 Aug 17:58] Paul Dubois
Posted by developer:
 
Fixed in 8.0.13.

For debug builds, if the server bootstrapping phase failed, missing
cleanup code caused an assertion to be raised.