Bug #90248 Assertion `binlog_checksum_options == var->save_result.ulonglong_value' failed
Submitted: 28 Mar 2018 20:04 Modified: 29 Mar 2018 13:51
Reporter: Sveta Smirnova (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7.21, 8.0.4 OS:Any
Assigned to: CPU Architecture:Any

[28 Mar 2018 20:04] Sveta Smirnova
Description:
Originally reported at https://jira.percona.com/browse/PS-3927

With version_tokens plugin installed statement `set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE");` crashes MySQL server

How to repeat:
Run server with options:

--gtid_mode=ON --enforce_gtid_consistency=ON --log_slave_updates=ON  --log_bin --binlog_format=ROW --server-id=1 --master-verify-checksum=1 --binlog-checksum=1  

Then connect to it and run:

INSTALL PLUGIN version_tokens SONAME 'version_token.so';
CREATE FUNCTION version_tokens_set RETURNS STRING SONAME 'version_token.so';
CREATE DATABASE test; use test;
SET GLOBAL binlog_error_action=IGNORE_ERROR;
set global super_read_only=1;
SET AUTOCOMMIT=0;
set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE");
[28 Mar 2018 20:05] Sveta Smirnova
test case for MTR

Attachment: PS-3927.test (application/octet-stream, text), 299 bytes.

[28 Mar 2018 20:05] Sveta Smirnova
Option file

Attachment: PS-3927-master.opt (application/octet-stream, text), 146 bytes.

[28 Mar 2018 20:06] Sveta Smirnova
Backtrace:

Thread pointer: 0x7f0460120090
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f04ad495e38 thread_stack 0x40000
/home/sveta/build/mysql-5.7/bin/mysqld(my_print_stacktrace+0x47)[0x1989090]
/home/sveta/build/mysql-5.7/bin/mysqld(handle_fatal_signal+0x3f3)[0xf2e476]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f04b2dd7390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f04b2189428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f04b218b02a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x7f04b2181bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7f04b2181c82]
/home/sveta/build/mysql-5.7/bin/mysqld(_ZN28Sys_var_enum_binlog_checksum13global_updateEP3THDP7set_var+0x110)[0x16f45d4]
/home/sveta/build/mysql-5.7/bin/mysqld(_ZN7sys_var6updateEP3THDP7set_var+0xa5)[0x15535a1]
/home/sveta/build/mysql-5.7/bin/mysqld(_ZN7set_var6updateEP3THD+0x38)[0x1554dcc]
/home/sveta/build/mysql-5.7/bin/mysqld(_Z17sql_set_variablesP3THDP4ListI12set_var_baseE+0x115)[0x1554684]
/home/sveta/build/mysql-5.7/bin/mysqld(_Z21mysql_execute_commandP3THDb+0x3529)[0x16234e1]
/home/sveta/build/mysql-5.7/bin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x598)[0x1628cf4]
/home/sveta/build/mysql-5.7/bin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0xc39)[0x161da79]
/home/sveta/build/mysql-5.7/bin/mysqld(_Z10do_commandP3THD+0x51a)[0x161c904]
/home/sveta/build/mysql-5.7/bin/mysqld(handle_connection+0x1ee)[0x175ea0c]
/home/sveta/build/mysql-5.7/bin/mysqld(pfs_spawn_thread+0x173)[0x1e4f1e7]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f04b2dcd6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f04b225b41d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f04602bef60): set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE")
Connection ID (thread ID): 3
Status: NOT_KILLED
[28 Mar 2018 20:37] Sveta Smirnova
Also affects version 8.0.4
[29 Mar 2018 10:01] MySQL Verification Team
Thank you for the bug report. I was able to repeat only with debug version. It's your case too?

Version: '5.7.21-debug-log'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server - Debug (GPL)
2018-03-29T09:58:24.999674Z 2 [ERROR] Got error 1 during FLUSH_LOGS
2018-03-29T09:58:24.999707Z 2 [ERROR] Could not open (null) for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
mysqld-debug: /export/home/pb2/build/sb_0-26514852-1514433850.9/mysql-5.7.21/sql/sys_vars.cc:3581: virtual bool Sys_var_enum_binlog_checksum::global_update(THD*, set_var*): Assertion `binlog_checksum_options == var->save_result.ulonglong_value' failed.
09:58:25 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68200 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f30a8000dd0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f30fc18ee10 thread_stack 0x40000
5.7/bin/mysqld-debug(my_print_stacktrace+0x35)[0x18dbffa]
5.7/bin/mysqld-debug(handle_fatal_signal+0x407)[0xed90f0]
/usr/lib/libpthread.so.0(+0x11dd0)[0x7f31052e9dd0]
/usr/lib/libc.so.6(gsignal+0x110)[0x7f3103c1a860]
/usr/lib/libc.so.6(abort+0x1c9)[0x7f3103c1bec9]
/usr/lib/libc.so.6(+0x2d0bc)[0x7f3103c130bc]
/usr/lib/libc.so.6(+0x2d133)[0x7f3103c13133]
5.7/bin/mysqld-debug(_ZN28Sys_var_enum_binlog_checksum13global_updateEP3THDP7set_var+0x101)[0x1659be1]
5.7/bin/mysqld-debug(_ZN7sys_var6updateEP3THDP7set_var+0x9b)[0x14c7551]
5.7/bin/mysqld-debug(_ZN7set_var6updateEP3THD+0x38)[0x14c8c82]
5.7/bin/mysqld-debug(_Z17sql_set_variablesP3THDP4ListI12set_var_baseE+0xeb)[0x14c8543]
5.7/bin/mysqld-debug(_Z21mysql_execute_commandP3THDb+0x3818)[0x1592d17]
5.7/bin/mysqld-debug(_Z11mysql_parseP3THDP12Parser_state+0x589)[0x1598606]
5.7/bin/mysqld-debug(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0xcc7)[0x158cf88]
5.7/bin/mysqld-debug(_Z10do_commandP3THD+0x4b3)[0x158bdcd]
5.7/bin/mysqld-debug(handle_connection+0x1e6)[0x16c2da8]
5.7/bin/mysqld-debug(pfs_spawn_thread+0x170)[0x191640c]
/usr/lib/libpthread.so.0(+0x708c)[0x7f31052df08c]
/usr/lib/libc.so.6(clone+0x3f)[0x7f3103cdbe7f]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f30a8005840): set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE")
Connection ID (thread ID): 2
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
[29 Mar 2018 13:31] Sveta Smirnova
Same for me: crash only in debug version.

Release version gives error:

mysqltest: At line 6: query 'set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE")' failed: 1290: The MySQL server is running with the --super-read-only option so it cannot execute this statement
[29 Mar 2018 13:51] MySQL Verification Team
Thank you for the feedback. Now testing with most recent source server I could n't repeat with release and debug server, so I assume it was fixed somwwhat.

miguel@tikal:~/dbs $ 5.7/bin/mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23-log Source distribution 2018-MAR-25

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> INSTALL PLUGIN version_tokens SONAME 'version_token.so';
Query OK, 0 rows affected (0,08 sec)

mysql> CREATE FUNCTION version_tokens_set RETURNS STRING SONAME 'version_token.so';
Query OK, 0 rows affected (0,05 sec)

mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SET GLOBAL binlog_error_action=IGNORE_ERROR;
Query OK, 0 rows affected (0,00 sec)

mysql> set global super_read_only=1;
Query OK, 0 rows affected (0,00 sec)

mysql> SET AUTOCOMMIT=0;
Query OK, 0 rows affected (0,00 sec)

mysql> set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE");
Query OK, 0 rows affected (0,20 sec)

mysql> show variables like "%version%";
+-------------------------------+---------------------------------+
| Variable_name                 | Value                           |
+-------------------------------+---------------------------------+
| innodb_version                | 5.7.23                          |
| protocol_version              | 10                              |
| slave_type_conversions        |                                 |
| tls_version                   | TLSv1,TLSv1.1                   |
| version                       | 5.7.23-log                      |
| version_comment               | Source distribution 2018-MAR-25 |
| version_compile_machine       | x86_64                          |
| version_compile_os            | Linux                           |
| version_tokens_session        |                                 |
| version_tokens_session_number | 0                               |
+-------------------------------+---------------------------------+
10 rows in set (0,02 sec)

mysql> 

miguel@tikal:~/dbsd $ 5.7/bin/mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.23-debug-log Source distribution 2018-MAR-25

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> INSTALL PLUGIN version_tokens SONAME 'version_token.so';
Query OK, 0 rows affected (0,18 sec)

mysql> CREATE FUNCTION version_tokens_set RETURNS STRING SONAME 'version_token.so';
Query OK, 0 rows affected (0,05 sec)

mysql> CREATE DATABASE test; use test;
Query OK, 1 row affected (0,05 sec)

Database changed
mysql> SET GLOBAL binlog_error_action=IGNORE_ERROR;
Query OK, 0 rows affected (0,00 sec)

mysql> set global super_read_only=1;
Query OK, 0 rows affected (0,00 sec)

mysql> SET AUTOCOMMIT=0;
Query OK, 0 rows affected (0,00 sec)

mysql> set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE");
Query OK, 0 rows affected (0,38 sec)

mysql> 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.12 Source distribution 2018-MAR-25

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> INSTALL PLUGIN version_tokens SONAME 'version_token.so';
Query OK, 0 rows affected (0,19 sec)

mysql> CREATE FUNCTION version_tokens_set RETURNS STRING SONAME 'version_token.so';
Query OK, 0 rows affected (0,31 sec)

mysql> CREATE DATABASE test; use test;
Query OK, 1 row affected (0,10 sec)

Database changed
mysql> SET GLOBAL binlog_error_action=IGNORE_ERROR;
Query OK, 0 rows affected (0,00 sec)

mysql> set global super_read_only=1;
Query OK, 0 rows affected (0,00 sec)

mysql> SET AUTOCOMMIT=0;
Query OK, 0 rows affected (0,00 sec)

mysql> set @@global.binlog_checksum=IF(floor((rand()*1000)%2),"CRC32","NONE");
Query OK, 0 rows affected (0,31 sec)

mysql>