Bug #90946 Assertion `get_state() >= 0' failed on RESET MASTER while tx_read_only
Submitted: 21 May 1:44 Modified: 1 Aug 6:45
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S6 (Debug Builds)
Version:5.7.21, 5.7.22 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[21 May 1:44] Roel Van de Paar
Description:
2018-05-21T01:41:24.432719Z 0 [Note] /sda/MS190418-mysql-5.7.21-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.21-debug'  socket: '/sda/MS190418-mysql-5.7.21-linux-x86_64-debug/socket.sock'  port: 14664  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/sql/rpl_gtid.h:536: void Checkable_rwlock::assert_no_wrlock() const: Assertion `get_state() >= 0' failed.
01:41:56 UTC - mysqld got signal 6 ;

#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055932d4e2f5d in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:249
#2  0x000055932ca8c716 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f3a53fb1801 in __GI_abort () at abort.c:79
#6  0x00007f3a53fa139a in __assert_fail_base (fmt=0x7f3a541287d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55932dac5a7b "get_state() >= 0", 
    file=file@entry=0x55932dac5a08 "/git/mysql-server_dbg/sql/rpl_gtid.h", line=line@entry=536, 
    function=function@entry=0x55932dad05c0 <Checkable_rwlock::assert_no_wrlock() const::__PRETTY_FUNCTION__> "void Checkable_rwlock::assert_no_wrlock() const") at assert.c:92
#7  0x00007f3a53fa1412 in __GI___assert_fail (assertion=0x55932dac5a7b "get_state() >= 0", 
    file=0x55932dac5a08 "/git/mysql-server_dbg/sql/rpl_gtid.h", line=536, 
    function=0x55932dad05c0 <Checkable_rwlock::assert_no_wrlock() const::__PRETTY_FUNCTION__> "void Checkable_rwlock::assert_no_wrlock() const") at assert.c:101
#8  0x000055932ca83375 in Checkable_rwlock::assert_no_wrlock (this=0x7f3a53430970) at /git/mysql-server_dbg/sql/rpl_gtid.h:536
#9  0x000055932ca830d0 in Checkable_rwlock::rdlock (this=0x7f3a53430970) at /git/mysql-server_dbg/sql/rpl_gtid.h:472
#10 0x000055932d3effaa in Gtid_state::update_gtids_impl (this=0x7f3a4f3a7a00, thd=0x7f3a19019000, is_commit=false)
    at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:230
#11 0x000055932d3efeb6 in Gtid_state::update_on_rollback (this=0x7f3a4f3a7a00, thd=0x7f3a19019000)
    at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:214
#12 0x000055932d285e94 in trans_rollback_stmt (thd=0x7f3a19019000) at /git/mysql-server_dbg/sql/transaction.cc:532
#13 0x000055932d0f580d in open_and_lock_tables (thd=0x7f3a19019000, tables=0x7f3a55d01b70, flags=18443, 
    prelocking_strategy=0x7f3a55d01a10) at /git/mysql-server_dbg/sql/sql_base.cc:6456
#14 0x000055932d0f51b1 in open_n_lock_single_table (thd=0x7f3a19019000, table_l=0x7f3a55d01b70, lock_type=TL_WRITE, flags=18443, 
    prelocking_strategy=0x7f3a55d01a10) at /git/mysql-server_dbg/sql/sql_base.cc:6278
#15 0x000055932d234945 in open_n_lock_single_table (thd=0x7f3a19019000, table_l=0x7f3a55d01b70, lock_type=TL_WRITE, flags=18443)
    at /git/mysql-server_dbg/sql/sql_base.h:470
#16 0x000055932d464637 in System_table_access::open_table (this=0x7f3a55d02200, thd=0x7f3a19019000, dbstr=..., tbstr=..., 
    max_num_field=3, lock_type=TL_WRITE, table=0x7f3a55d021d8, backup=0x7f3a55d02220)
    at /git/mysql-server_dbg/sql/rpl_table_access.cc:57
#17 0x000055932d3f7753 in Gtid_table_access_context::init (this=0x7f3a55d02200, thd=0x7f3a55d021c0, table=0x7f3a55d021d8, 
    is_write=true) at /git/mysql-server_dbg/sql/rpl_gtid_persist.cc:189
#18 0x000055932d3f93ec in Gtid_table_persistor::reset (this=0x7f3a53437070, thd=0x7f3a19019000)
    at /git/mysql-server_dbg/sql/rpl_gtid_persist.cc:699
#19 0x000055932d3ef73a in Gtid_state::clear (this=0x7f3a4f3a7a00, thd=0x7f3a19019000) at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:38
#20 0x000055932d467e7f in reset_master (thd=0x7f3a19019000) at /git/mysql-server_dbg/sql/rpl_master.cc:601
#21 0x000055932d1c2a71 in reload_acl_and_cache (thd=0x7f3a19019000, options=128, tables=0x0, write_to_binlog=0x7f3a55d02650)
    at /git/mysql-server_dbg/sql/sql_reload.cc:311
#22 0x000055932d17e177 in mysql_execute_command (thd=0x7f3a19019000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:4170
#23 0x000055932d181fa8 in mysql_parse (thd=0x7f3a19019000, parser_state=0x7f3a55d034f0) at /git/mysql-server_dbg/sql/sql_parse.cc:5582
#24 0x000055932d176d29 in dispatch_command (thd=0x7f3a19019000, com_data=0x7f3a55d03da0, command=COM_QUERY)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1458
#25 0x000055932d175bb3 in do_command (thd=0x7f3a19019000) at /git/mysql-server_dbg/sql/sql_parse.cc:999
#26 0x000055932d2b84bb in handle_connection (arg=0x7f3a2c7dc300)
    at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#27 0x000055932d9aabf7 in pfs_spawn_thread (arg=0x7f3a3dbef820) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2190
#28 0x00007f3a54cad6db in start_thread (arg=0x7f3a55d04700) at pthread_create.c:463
#29 0x00007f3a5409288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
# May require server-id to be set
SET @@SESSION.gtid_next=ANONYMOUS;
SET @@SESSION.tx_read_only=1;
RESET MASTER;
[21 May 1:44] Roel Van de Paar
See also bug 80168 with a different testcase
[21 May 5:44] Umesh Shastry
Hello Roel,

Thank you for the report.
Observed that 5.7.22 debug build is affected.

Thanks,
Umesh
[1 Aug 6:45] Roel Van de Paar
Any updates?