Bug #85064 end_anonymous_gtid_violating_transaction(): Assertion `old_value >= 1' failed.
Submitted: 20 Feb 2017 2:39 Modified: 20 Feb 2017 8:40
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:5.7.17 OS:Any
Assigned to: CPU Architecture:Any

[20 Feb 2017 2:39] Roel Van de Paar
Description:
Core was generated by `/sda/MS010217-mysql-5.7.17-linux-x86_64-debug/bin/mysqld --no-defaults --basedi'.
Program terminated with signal 6, Aborted.
#0  0x00007f98ffc02741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007f98ffc02741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000001826d71 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:249
#2  0x0000000000e75574 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f98fdf961d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f98fdf978c8 in __GI_abort () at abort.c:90
#6  0x00007f98fdf8f146 in __assert_fail_base (fmt=0x7f98fe0e03a8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x201918d "old_value >= 1",
    file=file@entry=0x2018f08 "/git/mysql-server_dbg/sql/rpl_gtid.h", line=line@entry=2603,
    function=function@entry=0x201a780 <Gtid_state::end_anonymous_gtid_violating_transaction()::__PRETTY_FUNCTION__> "void Gtid_state::end_anonymous_gtid_violating_transaction()")
    at assert.c:92
#7  0x00007f98fdf8f1f2 in __GI___assert_fail (assertion=0x201918d "old_value >= 1", file=0x2018f08 "/git/mysql-server_dbg/sql/rpl_gtid.h", line=2603,
    function=0x201a780 <Gtid_state::end_anonymous_gtid_violating_transaction()::__PRETTY_FUNCTION__> "void Gtid_state::end_anonymous_gtid_violating_transaction()")
    at assert.c:101
#8  0x000000000174aa1f in Gtid_state::end_anonymous_gtid_violating_transaction (this=0x7f98f5feaa00) at /git/mysql-server_dbg/sql/rpl_gtid.h:2603
#9  0x0000000001747c78 in Gtid_state::end_gtid_violating_transaction (this=0x7f98f5feaa00, thd=0x7f98c2019000) at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:273
#10 0x0000000001749fa1 in Gtid_state::update_gtids_impl_end (this=0x7f98f5feaa00, thd=0x7f98c2019000, more_trx=false) at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:1024
#11 0x0000000001747bad in Gtid_state::update_gtids_impl (this=0x7f98f5feaa00, thd=0x7f98c2019000, is_commit=true) at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:254
#12 0x0000000001747915 in Gtid_state::update_on_commit (this=0x7f98f5feaa00, thd=0x7f98c2019000) at /git/mysql-server_dbg/sql/rpl_gtid_state.cc:201
#13 0x000000000178c424 in MYSQL_BIN_LOG::rollback (this=0x2b5da40 <mysql_bin_log>, thd=0x7f98c2019000, all=false) at /git/mysql-server_dbg/sql/binlog.cc:2301
#14 0x00000000015f3818 in trans_rollback_stmt (thd=0x7f98c2019000) at /git/mysql-server_dbg/sql/transaction.cc:513
#15 0x00000000014f9f36 in mysql_execute_command (thd=0x7f98c2019000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:5038
#16 0x00000000014fb5f5 in mysql_parse (thd=0x7f98c2019000, parser_state=0x7f99001f4550) at /git/mysql-server_dbg/sql/sql_parse.cc:5611
#17 0x00000000014f0c1d in dispatch_command (thd=0x7f98c2019000, com_data=0x7f99001f4cb0, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1461
#18 0x00000000014efa44 in do_command (thd=0x7f98c2019000) at /git/mysql-server_dbg/sql/sql_parse.cc:999
#19 0x000000000161f9d0 in handle_connection (arg=0x7f98d53858c0) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#20 0x00000000018534f9 in pfs_spawn_thread (arg=0x7f98e3a76220) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2188
#21 0x00007f98ffbfddc5 in start_thread (arg=0x7f99001f5700) at pthread_create.c:308
#22 0x00007f98fe05873d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
The attached tarball (1486932588_bug_bundle.tar.gz) gives the testcase as an exact match of our system, including some handy utilities

$ vi 1486932588_mybase         # STEP1: Update the base path in this file (usually the only change required!). If you use a non-binary distribution, please update SOURCE_DIR location also
$ ./1486932588_init            # STEP2: Initializes the data dir
$ ./1486932588_start           # STEP3: Starts mysqld
$ ./1486932588_cl              # STEP4: To check mysqld is up
$ ./1486932588_run_pquery      # STEP5: Run the testcase with the pquery binary
$ ./1486932588_run             # OPTIONAL: Run the testcase with the mysql CLI (may not reproduce the issue, as the pquery binary was used for the original testcase reduction)
$ vi /dev/shm/1486932588/error.log.out  # STEP6: Verify the error log
$ ./1486932588_gdb             # OPTIONAL: Brings you to a gdb prompt with gdb attached to the used mysqld and attached to the generated core
$ ./1486932588_parse_core      # OPTIONAL: Creates 1486932588_STD.gdb and 1486932588_FULL.gdb; standard and full variables gdb stack traces
[20 Feb 2017 2:40] Roel Van de Paar
1486932588_bug_bundle.tar.gz

Attachment: 1486932588_bug_bundle.tar.gz (application/x-gzip, text), 1.79 MiB.

[20 Feb 2017 8:40] MySQL Verification Team
Hello Roel,

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

Thanks,
Umesh