Bug #78695 Assertion `static_cast<Sql_cmd_xa_commit*>(thd->lex->m_sql_cmd)-> get_xa_opt() =
Submitted: 5 Oct 2015 2:12 Modified: 30 Dec 2015 15:52
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S6 (Debug Builds)
Version:5.7.8 (RC2), 5.7.10, 8.0.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[5 Oct 2015 2:12] Roel Van de Paar
Description:
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/sql/handler.cc:1786: int ha_commit_low(THD*, bool, bool): Assertion `static_cast<Sql_cmd_xa_commit*>(thd->lex->m_sql_cmd)-> get_xa_opt() == XA_ONE_PHASE' failed.
02:02:26 UTC - mysqld got signal 6 ;

+bt
#0  0x00007ff6e17fa771 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  0x00007ff6e03fe5d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007ff6e03ffcc8 in __GI_abort () at abort.c:90
#6  0x00007ff6e03f7546 in __assert_fail_base (fmt=0x7ff6e0547128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x1cb3750 "static_cast<Sql_cmd_xa_commit*>(thd->lex->m_sql_cmd)-> get_xa_opt() == XA_ONE_PHASE", file=file@entry=0x1cb2fc8 "/git/mysql-server_dbg/sql/handler.cc", line=line@entry=1786, function=function@entry=0x1cb5880 <ha_commit_low(THD*, bool, bool)::__PRETTY_FUNCTION__> "int ha_commit_low(THD*, bool, bool)") at assert.c:92
#7  0x00007ff6e03f75f2 in __GI___assert_fail (assertion=0x1cb3750 "static_cast<Sql_cmd_xa_commit*>(thd->lex->m_sql_cmd)-> get_xa_opt() == XA_ONE_PHASE", file=0x1cb2fc8 "/git/mysql-server_dbg/sql/handler.cc", line=1786, function=0x1cb5880 <ha_commit_low(THD*, bool, bool)::__PRETTY_FUNCTION__> "int ha_commit_low(THD*, bool, bool)") at assert.c:101
#8  0x0000000000e3a5e1 in ha_commit_low (thd=0x7ff61681a000, all=true, run_after_commit=true) at /git/mysql-server_dbg/sql/handler.cc:1785
#9  0x00000000015158e6 in TC_LOG_DUMMY::commit (this=0x2a73888 <tc_log_dummy>, thd=0x7ff61681a000, all=true) at /git/mysql-server_dbg/sql/tc_log.cc:28
#10 0x0000000001529bc3 in Sql_cmd_xa_commit::trans_xa_commit (this=0x7ff61682ca38, thd=0x7ff61681a000) at /git/mysql-server_dbg/sql/xa.cc:354
#11 0x0000000001529dd5 in Sql_cmd_xa_commit::execute (this=0x7ff61682ca38, thd=0x7ff61681a000) at /git/mysql-server_dbg/sql/xa.cc:397
#12 0x0000000001423a51 in mysql_execute_command (thd=0x7ff61681a000) at /git/mysql-server_dbg/sql/sql_parse.cc:4549
#13 0x000000000142584f in mysql_parse (thd=0x7ff61681a000, parser_state=0x7ff6e1df3680) at /git/mysql-server_dbg/sql/sql_parse.cc:5255
#14 0x000000000141b458 in dispatch_command (thd=0x7ff61681a000, com_data=0x7ff6e1df3dc0, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1272
#15 0x000000000141a10e in do_command (thd=0x7ff61681a000) at /git/mysql-server_dbg/sql/sql_parse.cc:852
#16 0x0000000001541c80 in handle_connection (arg=0x7ff62a7c9200) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#17 0x000000000174e31f in pfs_spawn_thread (arg=0x7ff6d77e8d20) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2178
#18 0x00007ff6e17f5df5 in start_thread (arg=0x7ff6e1df4700) at pthread_create.c:308
#19 0x00007ff6e04bf1ad 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 test.t2(a INT,KEY (a));
XA START'';
INSERT INTO t2 VALUES('test000002'),('test000003'),('test000004');
xa end'';
XA PREPARE'';
SET @@session.pseudo_slave_mode=1;
XA COMMIT'';
[5 Oct 2015 2:12] Roel Van de Paar
Debug only
[5 Oct 2015 4:57] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that only 5.7(5.7.10), and 5.8.0(trunk) debug builds are affected.

Thanks,
Umesh
[5 Oct 2015 4:58] MySQL Verification Team
// 5.7.10 - only debug build affected

bin/mysql_install_db --insecure --basedir=/export/umesh/server/binaries/mysql-advanced-5.7.10 --datadir=/export/umesh/server/binaries/mysql-advanced-5.7.10/78695 -v
bin/mysqld-debug --no-defaults --basedir=/export/umesh/server/binaries/mysql-advanced-5.7.10 --datadir=/export/umesh/server/binaries/mysql-advanced-5.7.10/78695 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/server/binaries/mysql-advanced-5.7.10/78695/log.err 2>&1 &

- Build details

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.7.10: cat docs/INFO_SRC
commit: a814c74e87b4ef1a81c59f10805bdd9f9ff903d4
date: 2015-10-01 15:51:16 +0200
build-date: 2015-10-01 18:03:36 +0200
short: a814c74
branch: mysql-5.7

MySQL source 5.7.10

(gdb) bt
#0  0x00007f0655d8a771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000017e4450 in my_write_core (sig=6) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/mysys/stacktrace.c:247
#2  0x0000000000e507d2 in handle_fatal_signal (sig=6) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f06547845d7 in raise () from /lib64/libc.so.6
#5  0x00007f0654785cc8 in abort () from /lib64/libc.so.6
#6  0x00007f065477d546 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f065477d5f2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000ec453c in ha_commit_low (thd=0x7f05e4000b70, all=true, run_after_commit=true) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/handler.cc:1785
#9  0x00000000015d1f28 in TC_LOG_DUMMY::commit (this=0x2df5248 <tc_log_dummy>, thd=0x7f05e4000b70, all=true)
    at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/tc_log.cc:28
#10 0x00000000015e67a9 in Sql_cmd_xa_commit::trans_xa_commit (this=0x7f05e4005f88, thd=0x7f05e4000b70) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/xa.cc:372
#11 0x00000000015e691f in Sql_cmd_xa_commit::execute (this=0x7f05e4005f88, thd=0x7f05e4000b70) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/xa.cc:410
#12 0x00000000014dc3aa in mysql_execute_command (thd=0x7f05e4000b70, first_level=true) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/sql_parse.cc:4645
#13 0x00000000014de287 in mysql_parse (thd=0x7f05e4000b70, parser_state=0x7f062857ddd0) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/sql_parse.cc:5357
#14 0x00000000014d3ade in dispatch_command (thd=0x7f05e4000b70, com_data=0x7f062857ee00, command=COM_QUERY)
    at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/sql_parse.cc:1284
#15 0x00000000014d2977 in do_command (thd=0x7f05e4000b70) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/sql_parse.cc:852
#16 0x00000000015fef49 in handle_connection (arg=0x3d7d670) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/sql/conn_handler/connection_handler_per_thread.cc:295
#17 0x0000000001be60c4 in pfs_spawn_thread (arg=0x3dfbc90) at /export/home2/pb2/build/sb_0-16631979-1443716475.4/mysqlcom-pro-5.7.10/storage/perfschema/pfs.cc:2192
#18 0x00007f0655d85df5 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f065484560d in clone () from /lib64/libc.so.6
(gdb)
[5 Oct 2015 4:59] MySQL Verification Team
// 5.8.0  - only debug build affected

bin/mysql_install_db  --insecure --basedir=/export/umesh/server/binaries/mysql-advanced-5.8.0 --datadir=/export/umesh/server/binaries/mysql-advanced-5.8.0/78695 -v
bin/mysqld-debug --no-defaults --basedir=/export/umesh/server/binaries/mysql-advanced-5.8.0 --datadir=/export/umesh/server/binaries/mysql-advanced-5.8.0/78695 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/server/binaries/mysql-advanced-5.8.0/78695/log.err 2>&1 &

- Build details

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.8.0: cat docs/INFO_SRC
commit: f1ca5c4badf22b044ad613b5797338b2ec5ec613
date: 2015-10-01 15:53:30 +0200
build-date: 2015-10-01 17:06:11 +0200
short: f1ca5c4
branch: mysql-trunk

MySQL source 5.8.0

(gdb) bt
#0  0x00007f45cb045771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000017d703b in my_write_core (sig=6) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/mysys/stacktrace.cc:251
#2  0x0000000001011ccf in handle_fatal_signal (sig=6) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/signal_handler.cc:221
#3  <signal handler called>
#4  0x00007f45c9a3f5d7 in raise () from /lib64/libc.so.6
#5  0x00007f45c9a40cc8 in abort () from /lib64/libc.so.6
#6  0x00007f45c9a38546 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f45c9a385f2 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000010df17d in ha_commit_low (thd=0x7f454c000b70, all=true, run_after_commit=true) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/handler.cc:1745
#9  0x0000000000fd7948 in TC_LOG_DUMMY::commit (this=0x2cf6008 <tc_log_dummy>, thd=0x7f454c000b70, all=true)
    at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/tc_log.cc:30
#10 0x0000000000fe9c01 in Sql_cmd_xa_commit::trans_xa_commit (this=0x7f454c005fa8, thd=0x7f454c000b70)
    at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/xa.cc:417
#11 0x0000000000fe9d99 in Sql_cmd_xa_commit::execute (this=0x7f454c005fa8, thd=0x7f454c000b70) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/xa.cc:458
#12 0x0000000000eea5cf in mysql_execute_command (thd=0x7f454c000b70, first_level=true) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:4598
#13 0x0000000000eec44e in mysql_parse (thd=0x7f454c000b70, parser_state=0x7f459d828dd0) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:5305
#14 0x0000000000ee1f81 in dispatch_command (thd=0x7f454c000b70, com_data=0x7f459d829e00, command=COM_QUERY)
    at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:1251
#15 0x0000000000ee0e60 in do_command (thd=0x7f454c000b70) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:819
#16 0x00000000010021c3 in handle_connection (arg=0x4459cb0) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/sql/conn_handler/connection_handler_per_thread.cc:296
#17 0x000000000180ad84 in pfs_spawn_thread (arg=0x4788390) at /export/home2/pb2/build/sb_0-16631638-1443713022.55/mysqlcom-pro-5.8.0-m17/storage/perfschema/pfs.cc:2211
#18 0x00007f45cb040df5 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f45c9b0060d in clone () from /lib64/libc.so.6
(gdb)
[30 Dec 2015 15:52] David Moss
Thanks for your feedback. This has been fixed in upcoming versions and the following was added to the 5.7.11 change log:

If pseudo_slave_mode was set to 1 while an XA transaction was in the prepare stage, an assert was generated. The fix ensures that changes from 0 to 1 can be made during XA transactions. Note that this variable is solely for internal use by the server.
[31 Mar 2016 4:58] Erlend Dahl
Bug#78236 InnoDB: Failing assertion: holder != requestor

was marked as a duplicate.
[18 Jun 2016 21:28] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0