Bug #85364 handle_fatal_signal (sig=6) in Gtid_table_access_context::init
Submitted: 8 Mar 2017 8:06 Modified: 9 May 2017 14:49
Reporter: Ramesh Sivaraman Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Group Replication Severity:S3 (Non-critical)
Version:5.7.11, 5.7.17 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: debug

[8 Mar 2017 8:06] Ramesh Sivaraman
Description:
GDB info
{code}
#0  0x00007f41df0ce741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x00000000018507f8 in my_write_core (sig=6) at /home/ramesh/workdir/group_replication/percona-server_dbg/mysys/stacktrace.c:249
#2  0x0000000000e81eb1 in handle_fatal_signal (sig=6) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/signal_handler.cc:223
#3  <signal handler called>
#4  0x00007f41dd2555f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f41dd256ce8 in __GI_abort () at abort.c:90
#6  0x00007f41dd24e566 in __assert_fail_base (fmt=0x7f41dd39ece8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x2150568 "(*thd)->get_transaction()->xid_state()-> has_state(XID_STATE::XA_IDLE) || (*thd)->get_transaction()->xid_state()-> has_state(XID_STATE::XA_PREPARED)", file=file@entry=0x2150420 "/home/ramesh/workdir/group_replication/percona-server_dbg/sql/rpl_gtid_persist.cc", line=line@entry=180, function=function@entry=0x2150ec0 <Gtid_table_access_context::init(THD**, TABLE**, bool)::__PRETTY_FUNCTION__> "bool Gtid_table_access_context::init(THD**, TABLE**, bool)") at assert.c:92
#7  0x00007f41dd24e612 in __GI___assert_fail (assertion=0x2150568 "(*thd)->get_transaction()->xid_state()-> has_state(XID_STATE::XA_IDLE) || (*thd)->get_transaction()->xid_state()-> has_state(XID_STATE::XA_PREPARED)", file=0x2150420 "/home/ramesh/workdir/group_replication/percona-server_dbg/sql/rpl_gtid_persist.cc", line=180, function=0x2150ec0 <Gtid_table_access_context::init(THD**, TABLE**, bool)::__PRETTY_FUNCTION__> "bool Gtid_table_access_context::init(THD**, TABLE**, bool)") at assert.c:101
#8  0x00000000017759bd in Gtid_table_access_context::init (this=0x7f41d016b270, thd=0x7f41d016b318, table=0x7f41d016b320, is_write=true) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/rpl_gtid_persist.cc:177
#9  0x00000000017766e8 in Gtid_table_persistor::save (this=0x32bf760, gtid_set=0x7f41d016b3d0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/rpl_gtid_persist.cc:432
#10 0x00000000017703d0 in Gtid_state::save (this=0x331b220, gtid_set=0x7f41d016b3d0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/rpl_gtid_state.cc:732
#11 0x0000000001770575 in Gtid_state::save_gtids_of_last_binlog_into_table (this=0x331b220, on_rotation=true) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/rpl_gtid_state.cc:771
#12 0x00000000017be251 in MYSQL_BIN_LOG::new_file_impl (this=0x2cd38c0 <mysql_bin_log>, need_lock_log=false, extra_description_event=0x0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/binlog.cc:6810
#13 0x00000000017bdca1 in MYSQL_BIN_LOG::new_file_without_locking (this=0x2cd38c0 <mysql_bin_log>, extra_description_event=0x0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/binlog.cc:6695
#14 0x00000000017bfa27 in MYSQL_BIN_LOG::rotate (this=0x2cd38c0 <mysql_bin_log>, force_rotate=true, check_purge=0x7f41d016c14e) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/binlog.cc:7351
#15 0x00000000015e967b in Sys_var_enum_binlog_checksum::global_update (this=0x2cb4ca0 <Binlog_checksum_enum>, thd=0x7f41640008c0, var=0x7f4164004fc0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/sys_vars.cc:3750
#16 0x0000000001452eea in sys_var::update (this=0x2cb4ca0 <Binlog_checksum_enum>, thd=0x7f41640008c0, var=0x7f4164004fc0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/set_var.cc:183
#17 0x0000000001454604 in set_var::update (this=0x7f4164004fc0, thd=0x7f41640008c0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/set_var.cc:816
#18 0x0000000001453ec7 in sql_set_variables (thd=0x7f41640008c0, var_list=0x7f4164003290, free_joins=true) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/set_var.cc:672
#19 0x000000000151fa5a in mysql_execute_command (thd=0x7f41640008c0, first_level=true) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/sql_parse.cc:3896
#20 0x00000000015252fb in mysql_parse (thd=0x7f41640008c0, parser_state=0x7f41d016d4e0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/sql_parse.cc:5927
#21 0x0000000001519d11 in dispatch_command (thd=0x7f41640008c0, com_data=0x7f41d016dc90, command=COM_QUERY) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/sql_parse.cc:1493
#22 0x0000000001518b57 in do_command (thd=0x7f41640008c0) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/sql_parse.cc:1021
#23 0x00000000016571d0 in handle_connection (arg=0x37a7160) at /home/ramesh/workdir/group_replication/percona-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:312
#24 0x0000000001ce06b5 in pfs_spawn_thread (arg=0x37f6700) at /home/ramesh/workdir/group_replication/percona-server_dbg/storage/perfschema/pfs.cc:2188
#25 0x00007f41df0c9dc5 in start_thread (arg=0x7f41d016e700) at pthread_create.c:308
#26 0x00007f41dd316ced in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
{code}

How to repeat:
Testcase

DROP DATABASE test;
ALTER t t0ADD c c0CHAR exist;
XA START 'xid0';
SET @@GLOBAL.binlog_checksum=NONE;

The attached tarball gives the pquery binary to reproduce the issue

1) Start 3 Node group replication cluster
2) run pquery 

./pquery2-ps --infile=1488867676.sql --database=test --no-shuffle --threads=1  --user=root --socket=<mysql_socket> --log-all-queries --log-failed-queries

Check error log.
[8 Mar 2017 8:10] Ramesh Sivaraman
Testcase bundle

Attachment: bug_85364_bundle.tar.gz (application/gzip, text), 537 bytes.

[9 Mar 2017 8:07] MySQL Verification Team
Thank you for the report and test case.
Observed that only 5.7.17 debug build is affected.
[9 Mar 2017 8:08] MySQL Verification Team
-- Didn't notice any issue with 5.7.17 release build
[10 Mar 2017 20:22] Sven Sandberg
Posted by developer:
 
Please investigate if related to BUG#25641420.
[9 May 2017 14:49] Nuno Carvalho
Hi Ramesh,

Thank you for reporting this bug.
It is a duplicate of BUG#85220: Assertion `(*thd)->get_transaction()->xid_state()->has_state(XID_STATE::XA_...

It is so easily reproduced on Group Replication because, the bug is
triggered when the binary log must to be rotated, that is, so
configuration that affects binary log does happen and there is data
on the current binary log. The SET binlog_cheksum satisfies the
first requirement; the second is fulfilled by when a member joins a
group, even when there is no data on the group, it writes the view 
log events to the binary log.

The simplest test case to reproduce it on a single server it is on 
binary log suite: x.test

--source include/have_gtid.inc

CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT UNIQUE KEY NOT NULL);
XA START 'xid0';
SET @@GLOBAL.binlog_checksum=NONE;

Thence I setting this bug as a duplicate of BUG#85220.

Best regards,
Nuno Carvalho