Bug #86562 SERVER CRASHES IN MY_LOCALE_ERRMSGS::lookup due to INCORRECT option
Submitted: 2 Jun 2017 13:41 Modified: 15 Nov 2017 0:16
Reporter: Narendra Singh Chauhan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[2 Jun 2017 13:41] Narendra Singh Chauhan
Description:
Negative testing.

Scenario: When GR plugin is installed try to restart server with incorrect option name.
Expected output: Server should shutdown with gracefully.
Actual output: Shutdown completes with CRASH.

mysqld.1.err:-
===============
group_replication.gr_readmode_on_autostart [ fail ]
        Test ended at 2017-06-02 18:58:29

CURRENT_TEST: group_replication.gr_readmode_on_autostart
safe_process[20195]: Child process: 20196, killed by signal: 9

Server [mysqld.2 - pid: 20217, winpid: 20217, exit: 256] failed during test run
Server log from this test:
----------SERVER LOG START-----------
....
....
2017-06-02T13:28:25.986604Z 0 [ERROR] unknown option '--start-slave'
2017-06-02T13:28:25.986621Z 0 [ERROR] Aborting
2017-06-02T13:28:25.986764Z 0 [Note] InnoDB: FTS optimize thread exiting.
2017-06-02T13:28:26.089588Z 0 [Note] Binlog end
2017-06-02T13:28:26.092525Z 0 [Note] Shutting down plugin 'group_replication'
2017-06-02T13:28:26.092702Z 0 [Note] Plugin group_replication reported: 'All Group Replication server observers have been successfully unregistered'
2017-06-02T13:28:26.092968Z 0 [Note] Shutting down plugin 'ngram'
2017-06-02T13:28:26.093019Z 0 [Note] Shutting down plugin 'BLACKHOLE'
....
....
2017-06-02T13:28:27.673861Z 0 [Note] Debug sync points max active per thread: 0
2017-06-02T13:28:27.673873Z 0 [Note] /Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld: Shutdown complete

13:28:27 UTC - mysqld got signal 11 ;
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=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68186 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
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 = 0 thread_stack 0x46000
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(my_print_stacktrace+0x46) [0x29ad6b3]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(handle_fatal_signal+0x409) [0x20300cd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7ff46fe2fcb0]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(MY_LOCALE_ERRMSGS::lookup(int)+0x85) [0x2122343]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(ER_DEFAULT(int)+0x26) [0x212239f]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(get_server_errmsgs+0x7a) [0x2122448]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(LogEvent::set_message_by_errcode(long long, __va_list_tag*)+0x1f) [0x1ba774d]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(LogEvent::lookup(long long, ...)+0xa6) [0x1ba7b66]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x1b9149b]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x1b9259f]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x1b91c8d]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x1b9a3b9]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(mysqld_main(int, char**)+0x119c) [0x1b9caf1]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld(main+0x20) [0x1b8f758]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7ff46ea167ed]
/Narendra/mysql_work/git_repo/mysql-trunk/install/bin/mysqld() [0x1b8f649]
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.
Writing a core file
safe_process[20217]: Child process: 20218, killed by signal: 11
----------SERVER LOG END-------------

gdb output:-
=============
#0  __pthread_kill (threadid=<optimized out>, signo=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x00000000029ad794 in my_write_core () at /Narendra/mysql_work/git_repo/mysql-trunk/mysys/stacktrace.cc:291
#2  0x00000000020302b2 in handle_fatal_signal () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/signal_handler.cc:231
#3  <signal handler called>
#4  0x0000000002122343 in MY_LOCALE_ERRMSGS::lookup(int) () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/derror.cc:86
#5  0x000000000212239f in ER_DEFAULT(int) () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/derror.cc:95
#6  0x0000000002122448 in get_server_errmsgs () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/derror.cc:113
#7  0x0000000001ba774d in LogEvent::set_message_by_errcode(long long, __va_list_tag*) () at /Narendra/mysql_work/git_repo/mysql-trunk/include/mysql/components/services/log_builtins.h:746
#8  0x0000000001ba7b66 in LogEvent::lookup(long long, ...) () at /Narendra/mysql_work/git_repo/mysql-trunk/include/mysql/components/services/log_builtins.h:1124
#9  0x0000000001b9149b in component_infrastructure_deinit() () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/mysqld.cc:1485
#10 0x0000000001b9259f in clean_up(bool) () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/mysqld.cc:2008
#11 0x0000000001b91c8d in unireg_abort(int) () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/mysqld.cc:1780
#12 0x0000000001b9a3b9 in init_server_components() () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/mysqld.cc:4726
#13 0x0000000001b9caf1 in mysqld_main(int, char**) () at /Narendra/mysql_work/git_repo/mysql-trunk/sql/mysqld.cc:5504
#14 0x0000000001b8f758 in main ()

How to repeat:
Details:-
=========
MySQL Version: 8.0.2

Steps to repro:-
=================
1. Modify testcase gr_readmode_on_autostart.test restart_parameters slightly:
from:
57: --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_start_on_boot=1
to:
57: --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_start_on_boot=1 --start-slave

Note*: Here --start-slave is invalid option. We can use --abc etc invalid options.

Then, run command:- 
./mtr group_replication.gr_readmode_on_autostart.test --big-test
[15 Nov 2017 0:16] Paul DuBois
Posted by developer:
 
Fixed in 9.0.0.

Error logging could attempt to log freed messages, resulting in a
server exit.
[17 Nov 2017 15:08] Paul DuBois
Posted by developer:
 
Fixed in 8.0.4.