Bug #78337 Assertion `mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread)' faile
Submitted: 5 Sep 2015 6:06 Modified: 14 Sep 2015 15:31
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.7.8 RC2 OS:Any
Assigned to: CPU Architecture:Any

[5 Sep 2015 6:06] Roel Van de Paar
Description:
2015-09-05T05:53:53.423460Z 0 [Note] /sda/mysql-5.7.8-rc-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.8-rc-debug'  socket: '/sda/mysql-5.7.8-rc-linux-x86_64-debug/socket.sock'  port: 16775  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/include/thr_mutex.h:147: void safe_mutex_assert_owner(const my_mutex_t*): Assertion `mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread)' failed.
05:57:03 UTC - mysqld got signal 6 ;

+bt
#0  0x00007facdaf3f771 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000001721318 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:247
#2  0x0000000000dd6008 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007facd9b435d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007facd9b44cc8 in __GI_abort () at abort.c:90
#6  0x00007facd9b3c546 in __assert_fail_base (fmt=0x7facd9c8c128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x1df4fd0 "mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread)", file=file@entry=0x1df4fa0 "/git/mysql-server_dbg/include/thr_mutex.h", line=line@entry=147, function=function@entry=0x1df6d60 <_ZZ23safe_mutex_assert_ownerE19__PRETTY_FUNCTION__> "void safe_mutex_assert_owner(const my_mutex_t*)") at assert.c:92
#7  0x00007facd9b3c5f2 in __GI___assert_fail (assertion=0x1df4fd0 "mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread)", file=0x1df4fa0 "/git/mysql-server_dbg/include/thr_mutex.h", line=147, function=0x1df6d60 <_ZZ23safe_mutex_assert_ownerE19__PRETTY_FUNCTION__> "void safe_mutex_assert_owner(const my_mutex_t*)") at assert.c:101
#8  0x0000000001347fdb in safe_mutex_assert_owner (mp=0x7fac105a94a0) at /git/mysql-server_dbg/include/thr_mutex.h:146
#9  0x000000000134872e in Partition_share::release_auto_inc_if_possible (this=0x7fac1051b360, thd=0x7fac1041a000, next_insert_id=6, max_reserved=6) at /git/mysql-server_dbg/sql/partitioning/partition_handler.cc:128
#10 0x0000000001349d88 in Partition_helper::ph_release_auto_increment (this=0x7fac1043a710) at /git/mysql-server_dbg/sql/partitioning/partition_handler.cc:849
#11 0x0000000001882244 in ha_innopart::release_auto_increment (this=0x7fac1043a430) at /git/mysql-server_dbg/storage/innobase/handler/ha_innopart.h:572
#12 0x0000000000e3f591 in handler::ha_release_auto_increment (this=0x7fac1043a430) at /git/mysql-server_dbg/sql/handler.cc:3529
#13 0x00000000014b3f88 in copy_data_between_tables (psi=0x7facd4c1fb98, from=0x7fac1045ba20, to=0x7fac10550e20, create=..., copied=0x7facdb5369c8, deleted=0x7facdb5369c0, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7facdb535f00) at /git/mysql-server_dbg/sql/sql_table.cc:9763
#14 0x00000000014b262c in mysql_alter_table (thd=0x7fac1041a000, new_db=0x7fac1042cfa8 "test", new_name=0x0, create_info=0x7facdb536d90, table_list=0x7fac1042ca20, alter_info=0x7facdb536ce0) at /git/mysql-server_dbg/sql/sql_table.cc:9232
#15 0x000000000160432f in Sql_cmd_alter_table::execute (this=0x7fac1042d150, thd=0x7fac1041a000) at /git/mysql-server_dbg/sql/sql_alter.cc:316
#16 0x0000000001423a51 in mysql_execute_command (thd=0x7fac1041a000) at /git/mysql-server_dbg/sql/sql_parse.cc:4549
#17 0x000000000142584f in mysql_parse (thd=0x7fac1041a000, parser_state=0x7facdb538680) at /git/mysql-server_dbg/sql/sql_parse.cc:5255
#18 0x000000000141b458 in dispatch_command (thd=0x7fac1041a000, com_data=0x7facdb538dc0, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1272
#19 0x000000000141a10e in do_command (thd=0x7fac1041a000) at /git/mysql-server_dbg/sql/sql_parse.cc:852
#20 0x0000000001541c80 in handle_connection (arg=0x7fac23fc9200) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#21 0x000000000174e31f in pfs_spawn_thread (arg=0x7facd0fe8d20) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2178
#22 0x00007facdaf3adf5 in start_thread (arg=0x7facdb539700) at pthread_create.c:308
#23 0x00007facd9c041ad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(c1 INT,c2 CHAR)PARTITION BY HASH(c1) PARTITIONS 10;
insert into t1 values(0,0),(0,0),(0,0),(0,0),(0,0);
ALTER TABLE t1 CHANGE c1 c1 INT UNSIGNED AUTO_INCREMENT,ADD KEY(c1);

Asserts debug builds
[5 Sep 2015 7:13] Shane Bester
Thanks for the report!  Verified on current 5.7.  5.6 and 5.8 are not affected.
[14 Sep 2015 15:31] Jon Stephens
Fixed in 5.7.9. This issue affected debug builds only. Closed.