Bug #90551 [MySQL 8.0 GA Debug Build] Assertion `!thd->has_gtid_consistency_violation'
Submitted: 21 Apr 4:02 Modified: 30 Aug 15:01
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S6 (Debug Builds)
Version:8.0.11 GA OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[21 Apr 4:02] Roel Van de Paar
Description:
mysqld: /git/mysql-server_dbg/sql/rpl_gtid_execution.cc:91: bool set_gtid_next(THD*, const Gtid_specification&): Assertion `!thd->has_gtid_consistency_violation' failed.
03:54:02 UTC - mysqld got signal 6 ;

(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055d75927a4a5 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.cc:278
#2  0x000055d75800118c in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f615b67f801 in __GI_abort () at abort.c:79
#6  0x00007f615b66f39a in __assert_fail_base (fmt=0x7f615b7f67d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55d75a6d9248 "!thd->has_gtid_consistency_violation", 
    file=file@entry=0x55d75a6d9170 "/git/mysql-server_dbg/sql/rpl_gtid_execution.cc", line=line@entry=91, 
    function=function@entry=0x55d75a6d96a0 <set_gtid_next(THD*, Gtid_specification const&)::__PRETTY_FUNCTION__> "bool set_gtid_next(THD*, const Gtid_specification&)") at assert.c:92
#7  0x00007f615b66f412 in __GI___assert_fail (assertion=0x55d75a6d9248 "!thd->has_gtid_consistency_violation", 
    file=0x55d75a6d9170 "/git/mysql-server_dbg/sql/rpl_gtid_execution.cc", line=91, 
    function=0x55d75a6d96a0 <set_gtid_next(THD*, Gtid_specification const&)::__PRETTY_FUNCTION__> "bool set_gtid_next(THD*, const Gtid_specification&)")
    at assert.c:101
#8  0x000055d758e53bcf in set_gtid_next (thd=0x7f612dc23000, spec=...) at /git/mysql-server_dbg/sql/rpl_gtid_execution.cc:91
#9  0x000055d757f684b6 in Sys_var_gtid_next::session_update (this=0x55d75b8ce8a0 <Sys_gtid_next>, thd=0x7f612dc23000, var=0x7f612dc6fbb8)
    at /git/mysql-server_dbg/sql/sys_vars.cc:3529
#10 0x000055d757d86bf2 in sys_var::update (this=0x55d75b8ce8a0 <Sys_gtid_next>, thd=0x7f612dc23000, var=0x7f612dc6fbb8)
    at /git/mysql-server_dbg/sql/set_var.cc:258
#11 0x000055d757d89261 in set_var::update (this=0x7f612dc6fbb8, thd=0x7f612dc23000) at /git/mysql-server_dbg/sql/set_var.cc:1006
#12 0x000055d757d88681 in sql_set_variables (thd=0x7f612dc23000, var_list=0x7f612dc28a80, opened=true) at /git/mysql-server_dbg/sql/set_var.cc:771
#13 0x000055d757e5f49f in mysql_execute_command (thd=0x7f612dc23000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:3268
#14 0x000055d757e64bb2 in mysql_parse (thd=0x7f612dc23000, parser_state=0x7f615b63d330) at /git/mysql-server_dbg/sql/sql_parse.cc:4935
#15 0x000055d757e5a713 in dispatch_command (thd=0x7f612dc23000, com_data=0x7f615b63dc90, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1589
#16 0x000055d757e58fee in do_command (thd=0x7f612dc23000) at /git/mysql-server_dbg/sql/sql_parse.cc:1214
#17 0x000055d757feea70 in handle_connection (arg=0x7f611006f420) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#18 0x000055d75990ecf8 in pfs_spawn_thread (arg=0x7f614f3e7820) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2814
#19 0x00007f615d0696db in start_thread (arg=0x7f615b63e700) at pthread_create.c:463
#20 0x00007f615b76088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
DROP DATABASE test; CREATE DATABASE test; USE test;
XA START'';
XA END'';
XA PREPARE'';
CREATE TEMPORARY TABLE t1(c INT) ENGINE=InnoDB;
SET @@SESSION.gtid_next='anonymous';
[21 Apr 4:20] Miguel Solorzano
Release version not affected. Will test debug.

Server version: 8.0.12 Source distribution 2018-APR-18

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 8.0 > DROP DATABASE test; CREATE DATABASE test; USE test;
Query OK, 1 row affected (0,52 sec)

Query OK, 1 row affected (0,07 sec)

Database changed
mysql 8.0 > XA START'';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 > XA END'';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 > XA PREPARE'';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 > CREATE TEMPORARY TABLE t1(c INT) ENGINE=InnoDB;
ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
mysql 8.0 > SET @@SESSION.gtid_next='anonymous';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 >
[21 Apr 4:25] Miguel Solorzano
Thank you for the bug report. Debug server affected:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.12-debug Source distribution 2018-APR-18

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 8.0 > DROP DATABASE test; CREATE DATABASE test; USE test;
Query OK, 1 row affected (0,63 sec)

Query OK, 1 row affected (0,07 sec)

Database changed
mysql 8.0 > XA START'';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 > XA END'';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 > XA PREPARE'';
Query OK, 0 rows affected (0,00 sec)

mysql 8.0 > CREATE TEMPORARY TABLE t1(c INT) ENGINE=InnoDB;
ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
mysql 8.0 > SET @@SESSION.gtid_next='anonymous';
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql 8.0 > 

018-04-21T04:22:12.277777Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-04-21T04:22:12.398683Z 0 [System] [MY-010931] [Server] /home/miguel/dbsd/8.0/bin/mysqld: ready for connections. Version: '8.0.12-debug'  socket: '/tmp/mysql80.sock'  port: 3380  Source distribution 2018-APR-18.
mysqld: /home/miguel/buildd/2018APR18/mysql-8.0/sql/rpl_gtid_execution.cc:91: bool set_gtid_next(THD*, const Gtid_specification&): Assertion `!thd->has_gtid_consistency_violation' failed.
04:22:53 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=1
max_threads=151
thread_count=2
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 67877 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f1e5c000be0
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 = 7f1f0407ed38 thread_stack 0x46000
/home/miguel/dbsd/8.0/bin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x55) [0x411be4d]
/home/miguel/dbsd/8.0/bin/mysqld(handle_fatal_signal+0x424) [0x2e53f77]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f1f17b3b390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f1f16239428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f1f1623b02a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7) [0x7f1f16231bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82) [0x7f1f16231c82]
/home/miguel/dbsd/8.0/bin/mysqld(set_gtid_next(THD*, Gtid_specification const&)+0x29f) [0x3cd8d6d]
/home/miguel/dbsd/8.0/bin/mysqld(Sys_var_gtid_next::session_update(THD*, set_var*)+0x248) [0x2db9e88]
/home/miguel/dbsd/8.0/bin/mysqld(sys_var::update(THD*, set_var*)+0x14a) [0x2be63ac]
/home/miguel/dbsd/8.0/bin/mysqld(set_var::update(THD*)+0x4b) [0x2be8a53]
/home/miguel/dbsd/8.0/bin/mysqld(sql_set_variables(THD*, List<set_var_base>*, bool)+0x211) [0x2be7e74]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_execute_command(THD*, bool)+0x2683) [0x2caa525]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_parse(THD*, Parser_state*)+0x65e) [0x2cafbd0]
/home/miguel/dbsd/8.0/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x13a7) [0x2ca570c]
/home/miguel/dbsd/8.0/bin/mysqld(do_command(THD*)+0x484) [0x2ca3fc5]
/home/miguel/dbsd/8.0/bin/mysqld() [0x2e4174b]
/home/miguel/dbsd/8.0/bin/mysqld() [0x47eef1a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f1f17b316ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f1f1630b41d]
[30 Aug 15:01] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 5.7.24 and 8.0.13:

An assertion was raised in debug builds because the MySQL server recorded a GTID consistency violation, but did not remove the record after the relevant statement failed to execute successfully. The handling of this situation has now been improved to ensure that the server checks at the end of a transaction whether a GTID consistency violation was produced by a failed statement, and if this is the case, restores the previous GTID consistency state.