Bug #96639 Setting binlog_expire_logs_seconds and expire_logs_days results in crash
Submitted: 23 Aug 2019 13:17 Modified: 26 Aug 2019 11:01
Reporter: Hrvoje Matijakovic Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S6 (Debug Builds)
Version:8.0.17 OS:Linux
Assigned to: CPU Architecture:x86

[23 Aug 2019 13:17] Hrvoje Matijakovic
Description:
On a debug build this results in a crash:
mysql> SET @@global.binlog_expire_logs_seconds=-1024;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SELECT @@global.binlog_expire_logs_seconds;
+-------------------------------------+
| @@global.binlog_expire_logs_seconds |
+-------------------------------------+
|                                   0 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> SET @@global.expire_logs_days=1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SELECT @@global.expire_logs_days;
+---------------------------+
| @@global.expire_logs_days |
+---------------------------+
|                         1 |
+---------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> SET @@global.binlog_expire_logs_seconds=8734635;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> SELECT @@global.binlog_expire_logs_seconds;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/dev/shm/1566552666/socket.sock' (111)
ERROR:
Can't connect to the server

gdb:
Core was generated by `/sdc/MS230819-mysql-8.0.17-linux-x86_64-debug/bin/mysqld --no-defaults --basedi'.
Program terminated with signal 6, Aborted.
#0  0x00007f84a2f2d9d1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
59        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
+bt
#0  0x00007f84a2f2d9d1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:59
#1  0x0000000004580cc8 in my_write_core (sig=6) at /sdc/MS-8.0.17_dbg/mysys/stacktrace.cc:305
#2  0x00000000032f4d64 in handle_fatal_signal (sig=6) at /sdc/MS-8.0.17_dbg/sql/signal_handler.cc:168
#3  <signal handler called>
#4  0x00007f84a10302c7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#5  0x00007f84a10319b8 in __GI_abort () at abort.c:90
#6  0x00007f84a10290e6 in __assert_fail_base (fmt=0x7f84a1184020 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x505847e "error < 10000", file=file@entry=0x5057f98 "/sdc/MS-8.0.17_dbg/sql/mysqld.cc", line=line@entry=3434, function=function@entry=0x505f560 <my_message_sql::__PRETTY_FUNCTION__> "void my_message_sql(uint, const char*, myf)") at assert.c:92
#7  0x00007f84a1029192 in __GI___assert_fail (assertion=0x505847e "error < 10000", file=0x5057f98 "/sdc/MS-8.0.17_dbg/sql/mysqld.cc", line=3434, function=0x505f560 <my_message_sql::__PRETTY_FUNCTION__> "void my_message_sql(uint, const char*, myf)") at assert.c:101
#8  0x0000000002f98adb in my_message_sql (error=11079, str=0x7f849f9cfe50 "The option expire_logs_days cannot be used together with option binlog_expire_logs_seconds. Therefore, value of expire_logs_days is ignored.", MyFlags=0) at /sdc/MS-8.0.17_dbg/sql/mysqld.cc:3434
#9  0x00000000045746d2 in my_error (nr=11079, MyFlags=0) at /sdc/MS-8.0.17_dbg/mysys/my_error.cc:249
#10 0x00000000032480e5 in check_expire_logs_seconds (var=0x7f844747fbd0) at /sdc/MS-8.0.17_dbg/sql/sys_vars.cc:1954
#11 0x000000000303a065 in sys_var::check (this=0x76b7b60 <Sys_binlog_expire_logs_seconds>, thd=0x7f8447421000, var=0x7f844747fbd0) at /sdc/MS-8.0.17_dbg/sql/set_var.cc:348
#12 0x000000000303c2be in set_var::check (this=0x7f844747fbd0, thd=0x7f8447421000) at /sdc/MS-8.0.17_dbg/sql/set_var.cc:1041
#13 0x000000000303b7a6 in sql_set_variables (thd=0x7f8447421000, var_list=0x7f8447424aa0, opened=true) at /sdc/MS-8.0.17_dbg/sql/set_var.cc:818
#14 0x000000000312ac65 in mysql_execute_command (thd=0x7f8447421000, first_level=true) at /sdc/MS-8.0.17_dbg/sql/sql_parse.cc:3485
#15 0x00000000031304fe in mysql_parse (thd=0x7f8447421000, parser_state=0x7f849f9d1af0) at /sdc/MS-8.0.17_dbg/sql/sql_parse.cc:5221
#16 0x0000000003125aa9 in dispatch_command (thd=0x7f8447421000, com_data=0x7f849f9d2b90, command=COM_QUERY) at /sdc/MS-8.0.17_dbg/sql/sql_parse.cc:1755
#17 0x000000000312400c in do_command (thd=0x7f8447421000) at /sdc/MS-8.0.17_dbg/sql/sql_parse.cc:1270
#18 0x00000000032dffcd in handle_connection (arg=0x7f84500525c0) at /sdc/MS-8.0.17_dbg/sql/conn_handler/connection_handler_per_thread.cc:302
#19 0x0000000004d28926 in pfs_spawn_thread (arg=0x7f849f069fe0) at /sdc/MS-8.0.17_dbg/storage/perfschema/pfs.cc:2854
#20 0x00007f84a2f28dd5 in start_thread (arg=0x7f849f9d3700) at pthread_create.c:307
#21 0x00007f84a10f802d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Can't reproduce on the release build:
mysql> SET @@global.binlog_expire_logs_seconds=-1024;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SELECT @@global.binlog_expire_logs_seconds;
+-------------------------------------+
| @@global.binlog_expire_logs_seconds |
+-------------------------------------+
|                                   0 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> SET @@global.expire_logs_days=1;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> SELECT @@global.expire_logs_days;
+---------------------------+
| @@global.expire_logs_days |
+---------------------------+
|                         1 |
+---------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> SET @@global.binlog_expire_logs_seconds=8734635;
ERROR 11079 (HY000): The option expire_logs_days cannot be used together with option binlog_expire_logs_seconds. Therefore, value of expire_logs_days is ignored.

How to repeat:
SET @@global.binlog_expire_logs_seconds=-1024;
SET @@global.expire_logs_days=1;
SET @@global.binlog_expire_logs_seconds=8734635;
[26 Aug 2019 11:01] MySQL Verification Team
Hello Hrvoje Matijakovic,

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

regards,
Umesh