Description:
Scenario: When a member which also have running ASYNC channel goes into ERROR state, then upon executing 'STOP GROUP_REPLICATION' (as a next required step) hits with ASSERTION `!is_set()' failure at sql_error.cc:379.
mysqld.1.err:
=============
2018-07-21T08:43:59.357207Z 28 [Note] [MY-010570] [Repl] Slave I/O thread exiting for channel 'ch2_1', read up to log 'server-binary-log.000001', position 813
2018-07-21T08:43:59.367917Z 25 [Note] [MY-011651] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' has been stopped.'
mysqld: /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_error.cc:379: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `!is_set()' failed.
08:44:00 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=7
max_threads=151
thread_count=7
connection_count=6
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 67878 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x7f477d0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f46a00acd38 thread_stack 0x46000
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x55) [0x450a5e3]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(handle_fatal_signal+0x424) [0x31959bb]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f46b7442390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f46b5b37428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f46b5b3902a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7) [0x7f46b5b2fbd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82) [0x7f46b5b2fc82]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(Diagnostics_area::set_ok_status(unsigned long long, unsigned long long, char const*)+0x75) [0x2f6e513]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(my_ok(THD*, unsigned long long, unsigned long long, char const*)+0x4e) [0x2f65711]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(mysql_execute_command(THD*, bool)+0x1b3f) [0x2fd7eec]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(mysql_parse(THD*, Parser_state*, bool)+0x69c) [0x2fde17e]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x14b1) [0x2fd3b79]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(do_command(THD*)+0x484) [0x2fd20f9]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x31816d7]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x4c062a0]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f46b74386ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f46b5c0941d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7d491b8): STOP GROUP_REPLICATION
Connection ID (thread ID): 25
Status: NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file
safe_process[1616]: Child process: 1617, killed by signal: 6
gdb output:-
============
Thread 1 (Thread 0x7f46a00ad700 (LWP 1698)):
#0 __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1 0x000000000450a6d9 in my_write_core (sig=6) at /Narendra/mysql_work/git_repo/mysql-trunk/mysys/stacktrace.cc:278
#2 0x0000000003195bad in handle_fatal_signal (sig=6) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/signal_handler.cc:249
#3 <signal handler called>
#4 0x00007f46b5b37428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5 0x00007f46b5b3902a in __GI_abort () at abort.c:89
#6 0x00007f46b5b2fbd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x55991e8 "!is_set()", file=file@entry=0x5599000 "/Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_error.cc", line=line@entry=379, function=function@entry=0x5599580 <Diagnostics_area::set_ok_status(unsigned long long, unsigned long long, char const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at assert.c:92
#7 0x00007f46b5b2fc82 in __GI___assert_fail (assertion=0x55991e8 "!is_set()", file=0x5599000 "/Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_error.cc", line=379, function=0x5599580 <Diagnostics_area::set_ok_status(unsigned long long, unsigned long long, char const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at assert.c:101
#8 0x0000000002f6e513 in Diagnostics_area::set_ok_status (this=0x7f49ae0, affected_rows=0, last_insert_id=0, message_text=0x0) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_error.cc:379
#9 0x0000000002f65711 in my_ok (thd=0x7f477d0, affected_rows=0, id=0, message=0x0) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_class.h:4089
#10 0x0000000002fd7eec in mysql_execute_command (thd=0x7f477d0, first_level=true) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_parse.cc:3157
#11 0x0000000002fde17e in mysql_parse (thd=0x7f477d0, parser_state=0x7f46a00ac380, force_primary_storage_engine=false) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_parse.cc:5022
#12 0x0000000002fd3b79 in dispatch_command (thd=0x7f477d0, com_data=0x7f46a00accf0, command=COM_QUERY) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_parse.cc:1677
#13 0x0000000002fd20f9 in do_command (thd=0x7f477d0) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/sql_parse.cc:1233
#14 0x00000000031816d7 in handle_connection (arg=0x7ee28c0) at /Narendra/mysql_work/git_repo/mysql-trunk/sql/conn_handler/connection_handler_per_thread.cc:303
#15 0x0000000004c062a0 in pfs_spawn_thread (arg=0x7fa55b0) at /Narendra/mysql_work/git_repo/mysql-trunk/storage/perfschema/pfs.cc:2836
#16 0x00007f46b74386ba in start_thread (arg=0x7f46a00ad700) at pthread_create.c:333
#17 0x00007f46b5c0941d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
How to repeat:
Details:-
=========
MySQL Version tested: 8.0.14
Steps to repro:-
================
Run command: $ ./mtr group_replication.gr_is_set_assert.test
Where,
$ cat gr_is_set_assert.test
##############################################################################
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
--echo # Check all members are ONLINE.
SELECT * FROM performance_schema.replication_group_members;
eval CHANGE MASTER TO MASTER_HOST='localhost', MASTER_USER='root',
MASTER_PORT=$SERVER_MYPORT_2 for channel 'ch2_1';
START SLAVE FOR CHANNEL 'ch2_1';
--query_vertical SHOW SLAVE STATUS
--sleep 2
STOP SLAVE SQL_THREAD FOR CHANNEL 'group_replication_applier';
--sleep 2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")
SHOW WARNINGS;
--sleep 5
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo # Check server1 is in ERROR state
SELECT * FROM performance_schema.replication_group_members;
--echo
--echo # ISSUE HERE: ASSERTION failure
STOP GROUP_REPLICATION;
--source include/start_group_replication.inc
--die "OK TO STOP HERE"
Note*: Find attached MTR testcase output with this bug.