Bug #92070 Assertion `thd->variables.gtid_next.type == AUTOMATIC_GTID' failed.
Submitted: 19 Aug 2018 22:16 Modified: 25 Aug 2018 6:13
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities: Binlog Events Severity:S1 (Critical)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[19 Aug 2018 22:16] Roel Van de Paar
Description:
mysqld: /git/MS-8.0.12_dbg/sql/rpl_gtid_state.cc:905: void Gtid_state::update_gtids_impl_own_nothing(THD*): Assertion `thd->variables.gtid_next.type == AUTOMATIC_GTID' failed.

Core was generated by `/sda/2/bin/mysqld --no-defaults --core-file --basedir=/sda/2 --tmpdir=/sda/2/da'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f3b9b3f2700 (LWP 20622))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055b53d4cb78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055b53c21fd94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_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  0x00007f3b9b433801 in __GI_abort () at abort.c:79
#6  0x00007f3b9b42339a in __assert_fail_base (fmt=0x7f3b9b5aa7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55b53e94ae40 "thd->variables.gtid_next.type == AUTOMATIC_GTID", 
    file=file@entry=0x55b53e94a9a8 "/git/MS-8.0.12_dbg/sql/rpl_gtid_state.cc", line=line@entry=905, 
    function=function@entry=0x55b53e94c740 <Gtid_state::update_gtids_impl_own_nothing(THD*)::__PRETTY_FUNCTION__> "void Gtid_state::update_gtids_impl_own_nothing(THD*)") at assert.c:92
#7  0x00007f3b9b423412 in __GI___assert_fail (assertion=0x55b53e94ae40 "thd->variables.gtid_next.type == AUTOMATIC_GTID", 
    file=0x55b53e94a9a8 "/git/MS-8.0.12_dbg/sql/rpl_gtid_state.cc", line=905, 
    function=0x55b53e94c740 <Gtid_state::update_gtids_impl_own_nothing(THD*)::__PRETTY_FUNCTION__> "void Gtid_state::update_gtids_impl_own_nothing(THD*)") at assert.c:101
#8  0x000055b53d096cae in Gtid_state::update_gtids_impl_own_nothing (this=0x7f3b8ebe8100, thd=0x7f3b74023000)
    at /git/MS-8.0.12_dbg/sql/rpl_gtid_state.cc:905
#9  0x000055b53d0944b6 in Gtid_state::update_gtids_impl (this=0x7f3b8ebe8100, thd=0x7f3b74023000, is_commit=false)
    at /git/MS-8.0.12_dbg/sql/rpl_gtid_state.cc:234
#10 0x000055b53d0942d2 in Gtid_state::update_on_rollback (this=0x7f3b8ebe8100, thd=0x7f3b74023000)
    at /git/MS-8.0.12_dbg/sql/rpl_gtid_state.cc:208
#11 0x000055b53bfd8efe in close_temporary_tables (thd=0x7f3b74023000) at /git/MS-8.0.12_dbg/sql/sql_base.cc:1795
#12 0x000055b53d0b0631 in Format_description_log_event::do_apply_event (this=0x7f3b741433a0, rli=0x7f3b7413f000)
    at /git/MS-8.0.12_dbg/sql/log_event.cc:5780
#13 0x000055b53d0a949f in Log_event::apply_event (this=0x7f3b74143440, rli=0x7f3b7413f000)
    at /git/MS-8.0.12_dbg/sql/log_event.cc:3763
#14 0x000055b53d0ffb0b in mysql_client_binlog_statement (thd=0x7f3b74023000) at /git/MS-8.0.12_dbg/sql/sql_binlog.cc:268
#15 0x000055b53c076974 in mysql_execute_command (thd=0x7f3b74023000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4150
#16 0x000055b53c078f94 in mysql_parse (thd=0x7f3b74023000, parser_state=0x7f3b9b3f1330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#17 0x000055b53c06eaeb in dispatch_command (thd=0x7f3b74023000, com_data=0x7f3b9b3f1c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#18 0x000055b53c06d3c6 in do_command (thd=0x7f3b74023000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#19 0x000055b53c20d678 in handle_connection (arg=0x7f3b88b904c0)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#20 0x000055b53db7c422 in pfs_spawn_thread (arg=0x7f3b8ebe7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#21 0x00007f3b9ce1f6db in start_thread (arg=0x7f3b9b3f2700) at pthread_create.c:463
#22 0x00007f3b9b51488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
CREATE DATABASE test;
USE test;
SET @@global.id=2147483648*2-1;
SET SESSION autocommit=0;
create temporary TABLE t1(id int);
BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
[19 Aug 2018 22:38] Roel Van de Paar
Another testcase with no SET vars

# mysqld options required for replay: --sql_mode= 
CREATE DATABASE test;
USE test;
BINLOG ' O1ZVRw8BAAAAZgAAAGoAAAAAAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA7VlVHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC ';
CREATE PROCEDURE p1()BEGIN END;
ALTER TABLE mysql.tables_priv ENGINE=MyISAM;
DROP PROCEDURE IF EXISTS p1;
[20 Aug 2018 4:47] Umesh Shastry
Hello Roel,

Thank you for the report and test case.
Observed that 8.0.12 debug build is affected.

regards,
Umesh
[20 Aug 2018 4:48] Umesh Shastry
-- 5.7.23 release/debug with provided test cases - not affected
[25 Aug 2018 6:13] Roel Van de Paar
CREATE DATABASE test;
USE test;
CREATE PROCEDURE p1() BEGIN END;
BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
ALTER TABLE mysql.proxies_priv ENGINE = MyISAM;
DROP PROCEDURE IF EXISTS p1; ;