Bug #76416 Assertion `thd->variables.gtid_next.type== ANONYMOUS_GROUP' failed.
Submitted: 20 Mar 2015 22:39 Modified: 2 Jul 2015 14:24
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:5.7.5-m16, 5.7.6, 5.7.8, 8.0.0 OS:Any
Assigned to: CPU Architecture:Any

[20 Mar 2015 22:39] Roel Van de Paar
Description:
2015-03-20T22:36:31.566588Z 0 [Note] /sda/MS-mysql-5.7.6-m16-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.6-m16-debug'  socket: '/sda/MS-mysql-5.7.6-m16-linux-x86_64-debug/socket.sock'  port: 10430  MySQL Community Server (GPL)
2015-03-20T22:36:32.841520Z 2 [Note] Changed GTID_MODE from OFF to OFF_PERMISSIVE.
mysqld: /bzr/mysql-5.7.6-m16_dbg/sql/rpl_gtid_state.cc:414: void Gtid_state::end_gtid_violating_transaction(THD*): Assertion `thd->variables.gtid_next.type== ANONYMOUS_GROUP' failed.
22:36:33 UTC - mysqld got signal 6 ;

+bt
#0  0x00007f98be836771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013a521c in my_write_core (sig=6) at /bzr/mysql-5.7.6-m16_dbg/mysys/stacktrace.c:247
#2  0x0000000000bb713c in handle_fatal_signal (sig=6) at /bzr/mysql-5.7.6-m16_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f98bd43a5c9 in raise () from /lib64/libc.so.6
#5  0x00007f98bd43bcd8 in abort () from /lib64/libc.so.6
#6  0x00007f98bd433536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f98bd4335e2 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000012cdc12 in Gtid_state::end_gtid_violating_transaction (this=0x7f98b57e7a00, thd=0x7f981a41a000) at /bzr/mysql-5.7.6-m16_dbg/sql/rpl_gtid_state.cc:414
#9  0x00000000012cdb39 in Gtid_state::update_gtids_impl (this=0x7f98b57e7a00, thd=0x7f981a41a000, is_commit=true) at /bzr/mysql-5.7.6-m16_dbg/sql/rpl_gtid_state.cc:394
#10 0x00000000012cd47f in Gtid_state::update_on_commit (this=0x7f98b57e7a00, thd=0x7f981a41a000) at /bzr/mysql-5.7.6-m16_dbg/sql/rpl_gtid_state.cc:148
#11 0x0000000000c16fd4 in ha_commit_trans (thd=0x7f981a41a000, all=true, ignore_global_read_lock=false) at /bzr/mysql-5.7.6-m16_dbg/sql/handler.cc:1636
#12 0x0000000001199ccd in trans_commit_implicit (thd=0x7f981a41a000) at /bzr/mysql-5.7.6-m16_dbg/sql/transaction.cc:255
#13 0x00000000010a36ce in mysql_execute_command (thd=0x7f981a41a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:2336
#14 0x00000000010aae7a in mysql_parse (thd=0x7f981a41a000, parser_state=0x7f98bee2de00) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:5129
#15 0x00000000010a0bd4 in dispatch_command (command=COM_QUERY, thd=0x7f981a41a000, packet=0x7f981a446011 "DROP DATABASE test", packet_length=18) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:1249
#16 0x000000000109f925 in do_command (thd=0x7f981a41a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:835
#17 0x00000000011c2fd9 in handle_connection (arg=0x7f98b57f78c0) at /bzr/mysql-5.7.6-m16_dbg/sql/conn_handler/connection_handler_per_thread.cc:298
#18 0x00000000013d2299 in pfs_spawn_thread (arg=0x7f98b67b2d50) at /bzr/mysql-5.7.6-m16_dbg/storage/perfschema/pfs.cc:2147
#19 0x00007f98be831df3 in start_thread () from /lib64/libpthread.so.0
#20 0x00007f98bd4fb1ad in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
SET @@GLOBAL.GTID_MODE=OFF_PERMISSIVE;
set @@autocommit=0;
create temporary TABLE t1(a INT key);
SET SESSION GTID_NEXT='11111111-AAAA-2222-BBBB-000000000000:1';
DROP DATABASE test;
[21 Mar 2015 0:52] Roel Van de Paar
Note: requires a freshly init'ed server/datadir. If you execute testcase, get the crash and restart mysqld the crash will not happen again untill you wipe data and start afresh.
[21 Mar 2015 7:20] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Confirmed this with 5.7.6 debug build.

Thanks,
Umesh
[21 Mar 2015 7:21] MySQL Verification Team
// 5.7.6 debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76416 -v
bin/mysqld-debug --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76416 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.6/76416/log.err 2>&1 &

- build

commit: e1298eb6a8e2247361533811930a07fde7aff618
date: 2015-02-26 15:29:31 +0100
build-date: 2015-02-26 15:35:58 +0100
short: e1298eb
branch: mysql-5.7.6-m16-release

MySQL source 5.7.6

(gdb) bt
#0  0x00007feeb177d771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013ee069 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/mysys/stacktrace.c:247
#2  0x0000000000bdeba0 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007feeb03835c9 in raise () from /lib64/libc.so.6
#5  0x00007feeb0384cd8 in abort () from /lib64/libc.so.6
#6  0x00007feeb037c536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007feeb037c5e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000001316564 in Gtid_state::end_gtid_violating_transaction (this=0x45cb830, thd=0x7fee30000bb0)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/rpl_gtid_state.cc:414
#9  0x0000000001316495 in Gtid_state::update_gtids_impl (this=0x45cb830, thd=0x7fee30000bb0, is_commit=true)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/rpl_gtid_state.cc:394
#10 0x0000000001315df3 in Gtid_state::update_on_commit (this=0x45cb830, thd=0x7fee30000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/rpl_gtid_state.cc:148
#11 0x0000000000c3f193 in ha_commit_trans (thd=0x7fee30000bb0, all=true, ignore_global_read_lock=false) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/handler.cc:1636
#12 0x00000000011da781 in trans_commit_implicit (thd=0x7fee30000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/transaction.cc:255
#13 0x00000000010e1851 in mysql_execute_command (thd=0x7fee30000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:2336
#14 0x00000000010e9a6f in mysql_parse (thd=0x7fee30000bb0, parser_state=0x7fee999145d0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:5129
#15 0x00000000010debc8 in dispatch_command (command=COM_QUERY, thd=0x7fee30000bb0, packet=0x7fee30009ce1 "DROP DATABASE test", packet_length=18)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:1249
#16 0x00000000010dd693 in do_command (thd=0x7fee30000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:835
#17 0x000000000120444f in handle_connection (arg=0x527b410) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#18 0x00000000017770f1 in pfs_spawn_thread (arg=0x52a6560) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/perfschema/pfs.cc:2147
#19 0x00007feeb1778df3 in start_thread () from /lib64/libpthread.so.0
#20 0x00007feeb044447d in clone () from /lib64/libc.so.6

// Also, asserted with

(gdb) bt
#0  0x00007ffcd1ca5771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013ee069 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/mysys/stacktrace.c:247
#2  0x0000000000bdeba0 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007ffcd08ab5c9 in raise () from /lib64/libc.so.6
#5  0x00007ffcd08accd8 in abort () from /lib64/libc.so.6
#6  0x00007ffcd08a4536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007ffcd08a45e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000001316465 in Gtid_state::update_gtids_impl (this=0x47ea830, thd=0x7ffc5c000bb0, is_commit=false)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/rpl_gtid_state.cc:388
#9  0x0000000001315ee1 in Gtid_state::update_on_rollback (this=0x47ea830, thd=0x7ffc5c000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/rpl_gtid_state.cc:177
#10 0x0000000000c3f71f in ha_rollback_trans (thd=0x7ffc5c000bb0, all=true) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/handler.cc:1830
#11 0x00000000011da987 in trans_rollback (thd=0x7ffc5c000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/transaction.cc:303
#12 0x00000000010829d7 in THD::cleanup (this=0x7ffc5c000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_class.cc:1813
#13 0x0000000001082d88 in THD::release_resources (this=0x7ffc5c000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_class.cc:1905
#14 0x00000000012044a8 in handle_connection (arg=0x54a7bc0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:307
#15 0x00000000017770f1 in pfs_spawn_thread (arg=0x549abf0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/perfschema/pfs.cc:2147
#16 0x00007ffcd1ca0df3 in start_thread () from /lib64/libpthread.so.0
#17 0x00007ffcd096c47d in clone () from /lib64/libc.so.6
[21 Mar 2015 7:29] MySQL Verification Team
// 5.7.8 - only debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.8 --datadir=/export/umesh/mysql-5.7.8/76416 -v
bin/mysqld-debug --basedir=/export/umesh/mysql-5.7.8 --datadir=/export/umesh/mysql-5.7.8/76416 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.8/76416/log.err 2>&1 &
more ~umshastr/.mysql_secret 

- build

commit: 91153f3385c4917a215aa4c7818b3f6265608286
date: 2015-03-20 14:48:27 +0100
build-date: 2015-03-20 18:03:24 +0100
short: 91153f3
branch: mysql-5.7

MySQL source 5.7.8

(gdb) bt
#0  0x00007f96ba3f6771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000018c6688 in my_write_core (sig=6) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/mysys/stacktrace.c:247
#2  0x0000000000f4b39e in handle_fatal_signal (sig=6) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f96b8ffc5c9 in raise () from /lib64/libc.so.6
#5  0x00007f96b8ffdcd8 in abort () from /lib64/libc.so.6
#6  0x00007f96b8ff5536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f96b8ff55e2 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000017ef2a6 in Gtid_state::end_gtid_violating_transaction (this=0x407c900, thd=0x7f9628000bb0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/rpl_gtid_state.cc:414
#9  0x00000000017ef1cd in Gtid_state::update_gtids_impl (this=0x407c900, thd=0x7f9628000bb0, is_commit=true)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/rpl_gtid_state.cc:394
#10 0x00000000017eeb13 in Gtid_state::update_on_commit (this=0x407c900, thd=0x7f9628000bb0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/rpl_gtid_state.cc:148
#11 0x0000000000fb0010 in ha_commit_trans (thd=0x7f9628000bb0, all=true, ignore_global_read_lock=false)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/handler.cc:1665
#12 0x00000000016b6629 in trans_commit_implicit (thd=0x7f9628000bb0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/transaction.cc:255
#13 0x00000000015bfee5 in mysql_execute_command (thd=0x7f9628000bb0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:2354
#14 0x00000000015c78b1 in mysql_parse (thd=0x7f9628000bb0, parser_state=0x7f96a253ae50) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:5201
#15 0x00000000015bd46c in dispatch_command (thd=0x7f9628000bb0, com_data=0x7f96a253be00, command=COM_QUERY)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:1280
#16 0x00000000015bc0bf in do_command (thd=0x7f9628000bb0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:851
#17 0x00000000016e052e in handle_connection (arg=0x4d0c090) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/conn_handler/connection_handler_per_thread.cc:299
#18 0x0000000001ce1375 in pfs_spawn_thread (arg=0x4d79a20) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/storage/perfschema/pfs.cc:2147
#19 0x00007f96ba3f1df3 in start_thread () from /lib64/libpthread.so.0
#20 0x00007f96b90bd47d in clone () from /lib64/libc.so.6
[21 Mar 2015 7:32] MySQL Verification Team
// 5.8.0 - only debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.8.0 --datadir=/export/umesh/mysql-5.8.0/76416 -v
bin/mysqld --basedir=/export/umesh/mysql-5.8.0 --datadir=/export/umesh/mysql-5.8.0/76416 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.8.0/76416/log.err 2>&1 &
more ~umshastr/.mysql_secret 

- build

commit: b48798db34fbcaf5dbb5c8ae7ef738afeb60eccc
date: 2015-03-20 14:52:33 +0100
build-date: 2015-03-20 17:03:10 +0100
short: b48798d
branch: mysql-trunk

MySQL source 5.8.0

(gdb) bt
#0  0x00007f1626637771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000018b3108 in my_write_core (sig=6) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/mysys/stacktrace.c:247
#2  0x0000000000f3d9fb in handle_fatal_signal (sig=6) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/signal_handler.cc:221
#3  <signal handler called>
#4  0x00007f162523d5c9 in raise () from /lib64/libc.so.6
#5  0x00007f162523ecd8 in abort () from /lib64/libc.so.6
#6  0x00007f1625236536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f16252365e2 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000017dbee2 in Gtid_state::end_gtid_violating_transaction (this=0x38c5ca0, thd=0x7f159c000bb0)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/rpl_gtid_state.cc:415
#9  0x00000000017dbe09 in Gtid_state::update_gtids_impl (this=0x38c5ca0, thd=0x7f159c000bb0, is_commit=true)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/rpl_gtid_state.cc:395
#10 0x00000000017db74f in Gtid_state::update_on_commit (this=0x38c5ca0, thd=0x7f159c000bb0)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/rpl_gtid_state.cc:149
#11 0x0000000000fa5037 in ha_commit_trans (thd=0x7f159c000bb0, all=true, ignore_global_read_lock=false)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/handler.cc:1668
#12 0x00000000016a05e9 in trans_commit_implicit (thd=0x7f159c000bb0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/transaction.cc:256
#13 0x00000000015a911e in mysql_execute_command (thd=0x7f159c000bb0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:2323
#14 0x00000000015b0a1d in mysql_parse (thd=0x7f159c000bb0, parser_state=0x7f160e71ee50) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:5158
#15 0x00000000015a66e6 in dispatch_command (thd=0x7f159c000bb0, com_data=0x7f160e71fe00, command=COM_QUERY)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:1245
#16 0x00000000015a5335 in do_command (thd=0x7f159c000bb0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:814
#17 0x00000000016ca436 in handle_connection (arg=0x45556d0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/conn_handler/connection_handler_per_thread.cc:300
#18 0x0000000001c59c8d in pfs_spawn_thread (arg=0x45c3170) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/storage/perfschema/pfs.cc:2147
#19 0x00007f1626632df3 in start_thread () from /lib64/libpthread.so.0
#20 0x00007f16252fe47d in clone () from /lib64/libc.so.6
[21 Mar 2015 7:35] MySQL Verification Team
// 5.6 and below versions are not affected (gtid_mode is not dynamic variable <= 5.7.5)
[2 Jul 2015 14:24] David Moss
Thanks for your feedback. This has been fixed in an upcoming release and the following was added to the 5.7.8 changelog:

When using row-based logging with autocommit disabled and GTID_MODE=OFF_PERMISSIVE, if a transaction started with a CREATE TEMPORARY TABLE statement, then regardless of whether the table was transactional or non-transactional, the transaction began an automatic GTID violating transaction. However, if GTID_NEXT='UUID:NUMBER' was issued immediately after executing the CREATE TEMPORARY TABLE statement, which sets gtid_next type to GTID_GROUP, upon committing the transaction, a check for possible violation of GTID consistency was causing an assertion failure because the gtid_next type had been changed from AUTOMATIC_GROUP to GTID_GROUP.

The fix ensures that transactions with an empty owned GTID correctly check if they break GTID consistency. As part of this fix, it was found that when autocommit was disabled, the statement CREATE TEMPORARY TABLE did not start a transaction, so immediately setting GTID_NEXT='UUID:NUMBER' could not cause an error. The fix ensures that when autocommit is disabled, executing CREATE TEMPORARY TABLE or DROP TEMPORARY TABLE starts a transaction, regardless of the state of log_bin, binlog_format and whether a transactional or non-transactional storage engine is in use. This makes the behavior consistent, but is a change in logging when log-bin=OFF.
[18 Jun 2016 21:25] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0