Bug #86256 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server.
Submitted: 10 May 2017 5:11 Modified: 21 Aug 2018 4:15
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities: Binlog Events Severity:S6 (Debug Builds)
Version:5.7.17, 5.7.18, 8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[10 May 2017 5:11] Roel Van de Paar
Description:
mysql> CREATE TABLE t1 (a varchar(2) character set ucs2) PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (0x2020), PARTITION p1 VALUES IN (''));
ERROR 1598 (HY000): Binary logging not possible. Message: An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server.
mysql> SELECT 1;  #Shows server is gone
ERROR 2006 (HY000): MySQL server has gone away

2017-05-10T04:37:13.068307Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
2017-05-10T04:37:13.068325Z 0 [Note] Beginning of list of non-natively partitioned tables
2017-05-10T04:37:13.090476Z 0 [Note] End of list of non-natively partitioned tables
2017-05-10T04:37:13.090634Z 0 [Note] /sda/MS010217-mysql-5.7.17-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.17-debug-log'  socket: '/sda/MS010217-mysql-5.7.17-linux-x86_64-debug/socket.sock'  port: 18388  MySQL Community Server (GPL)
2017-05-10T04:37:27.754416Z 3 [Note] @@GLOBAL.GTID_PURGED was changed from '' to '51f3c555-353a-11e7-893b-902b34625689:1-9223372036854775805'.
2017-05-10T04:37:27.754482Z 3 [Note] @@GLOBAL.GTID_EXECUTED was changed from '' to '51f3c555-353a-11e7-893b-902b34625689:1-9223372036854775805'.
2017-05-10T04:37:27.755149Z 3 [Note] Changed GTID_MODE from OFF to OFF_PERMISSIVE.
2017-05-10T04:37:27.804310Z 3 [Note] Changed GTID_MODE from OFF_PERMISSIVE to ON_PERMISSIVE.
2017-05-10T04:37:28.111548Z 3 [ERROR] /sda/MS010217-mysql-5.7.17-linux-x86_64-debug/bin/mysqld: Binary logging not possible. Message: An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server.
04:37:28 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS010217-mysql-5.7.17-linux-x86_64-debug/bin/mysqld --no-defaults --sql_mo'.
Program terminated with signal 6, Aborted.
#0  0x00007f0beda85741 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  0x00007f0beda85741 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  0x00007f0bebe191d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f0bebe1a8c8 in __GI_abort () at abort.c:90
#6  0x000000000178aaf0 in exec_binlog_error_action_abort (
    err_string=0x7f0bee0751a0 "An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server.") at /git/mysql-server_dbg/sql/binlog.cc:1752
#7  0x000000000179b8ac in MYSQL_BIN_LOG::handle_binlog_flush_or_sync_error (this=0x2b5da40 <mysql_bin_log>, thd=0x7f0bafc19000, 
    need_lock_log=false) at /git/mysql-server_dbg/sql/binlog.cc:8821
#8  0x000000000179c016 in MYSQL_BIN_LOG::ordered_commit (this=0x2b5da40 <mysql_bin_log>, thd=0x7f0bafc19000, all=false, 
    skip_commit=false) at /git/mysql-server_dbg/sql/binlog.cc:9031
#9  0x000000000179a5eb in MYSQL_BIN_LOG::commit (this=0x2b5da40 <mysql_bin_log>, thd=0x7f0bafc19000, all=false)
    at /git/mysql-server_dbg/sql/binlog.cc:8257
#10 0x00000000015f3618 in trans_commit_stmt (thd=0x7f0bafc19000) at /git/mysql-server_dbg/sql/transaction.cc:463
#11 0x00000000014f9f63 in mysql_execute_command (thd=0x7f0bafc19000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:5043
#12 0x00000000014fb5f5 in mysql_parse (thd=0x7f0bafc19000, parser_state=0x7f0bee077550) at /git/mysql-server_dbg/sql/sql_parse.cc:5611
#13 0x00000000014f0c1d in dispatch_command (thd=0x7f0bafc19000, com_data=0x7f0bee077cb0, command=COM_QUERY)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1461
#14 0x00000000014efa44 in do_command (thd=0x7f0bafc19000) at /git/mysql-server_dbg/sql/sql_parse.cc:999
#15 0x000000000161f9d0 in handle_connection (arg=0x7f0bc2f88960)
    at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#16 0x00000000018534f9 in pfs_spawn_thread (arg=0x7f0bd1676220) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2188
#17 0x00007f0beda80dc5 in start_thread (arg=0x7f0bee078700) at pthread_create.c:308
#18 0x00007f0bebedb73d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
SET GLOBAL gtid_purged = CONCAT(@@GLOBAL.server_uuid, ':1-9223372036854775805');
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET global gtid_mode=on_permissive;
CREATE TABLE `#mysql50#c@d` (a INT) ENGINE=nonexisting;
CREATE TABLE t1 (a varchar(2) character set ucs2) PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (0x2020), PARTITION p1 VALUES IN (''));
SELECT 1;  #Shows server is gone
[10 May 2017 6:58] Umesh Shastry
Hello Roel,

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

Thanks,
Umesh
[14 Sep 2017 12:00] Carmelo Emanuele San Giovanni
Version 5.7.19 is affected too.
[17 Nov 2017 0:35] Saurabh Bhartia
seems still exists on 5.7.20

Do we know what version on 5.7.x does not have this issue/bug ?
does 5.7.16 has it ?
[21 Aug 2018 4:15] Roel Van de Paar
8.0.12 Affected also.

An any reason why this bug is not fixed yet? It does not seem to be an edge case.

8.0.12>DROP DATABASE test; 
ERROR 1598 (HY000): Binary logging not possible. Message: An error occurred during flush stage of the commit. 'binlog_error_action' is set to 'ABORT_SERVER'. Hence aborting the server.

Another testcase

SET GLOBAL GTID_MODE='OFF_PERMISSIVE';
SET GLOBAL GTID_PURGED=CONCAT(@@GLOBAL.server_uuid,':1-9223372036854775805');
SET GLOBAL GTID_MODE='ON_PERMISSIVE';
INSERT INTO mysql.db (host,db,user,select_priv) VALUES ('a','a%','test11','Y'),
('a','ab%','test11','Y');
DROP DATABASE test;
[20 Dec 2018 10:54] Ramesh Sivaraman
Another testcase 

# mysqld options required for replay:  --gtid_mode=ON --enforce_gtid_consistency=ON

CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 INT KEY,c2 BINARY,c3 TIMESTAMP);
RESET MASTER;
SET GLOBAL gtid_purged=CONCAT(@@GLOBAL.server_uuid,':1-9223372036854775805');
CREATE TABLE t2(cn char KEY);
ALTER TABLE t1 ORDER BY c1;

Server version - 8.0.13