Bug #87984 deadlock with --log-isam=myisam.log --myisam_use_mmap=1 --initialize-insecure
Submitted: 5 Oct 2017 4:20 Modified: 5 Oct 2017 6:21
Reporter: Nikolai Ikhalainen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:5.7.19 OS:Any
Assigned to: CPU Architecture:Any

[5 Oct 2017 4:20] Nikolai Ikhalainen
Description:
mysql hangs if initial database created with --log-isam=myisam.log --myisam_use_mmap=1 options:

Initializing database
2017-10-05T04:04:01.999548Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-10-05T04:04:04.009678Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-10-05T04:04:04.593840Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-10-05T04:04:05.233183Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3a9d7c74-a982-11e7-bb44-0242ac110002.
2017-10-05T04:04:05.327721Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-10-05T04:04:05.364365Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

pt-pmp 
Thu Oct  5 04:06:56 UTC 2017
92      pthread_join.c: No such file or directory.
     10 libaio::??(libaio.so.1),LinuxAIOHandler::collect,LinuxAIOHandler::poll,os_aio_handler,fil_aio_wait,io_handler_thread,start_thread,clone
      3 pthread_cond_wait,os_event::wait_low,srv_worker_thread,start_thread,clone
      1 pthread_join,bootstrap,mysqld_main,__libc_start_main,_start
      1 pthread_cond_wait,os_event::wait_low,srv_purge_coordinator_thread,start_thread,clone
      1 pthread_cond_wait,os_event::wait_low,buf_resize_thread,start_thread,clone
      1 pthread_cond_wait,os_event::wait_low,buf_dump_thread,start_thread,clone
      1 pthread_cond_timedwait,os_event::timed_wait,os_event::wait_time_low,srv_monitor_thread,start_thread,clone
      1 pthread_cond_timedwait,os_event::timed_wait,os_event::wait_time_low,srv_error_monitor_thread,start_thread,clone
      1 pthread_cond_timedwait,os_event::timed_wait,os_event::wait_time_low,lock_wait_timeout_thread,start_thread,clone
      1 pthread_cond_timedwait,os_event::timed_wait,os_event::wait_time_low,ib_wqueue_timedwait,fts_optimize_thread,start_thread,clone
      1 pthread_cond_timedwait,os_event::timed_wait,os_event::wait_time_low,dict_stats_thread,start_thread,clone
      1 pthread_cond_timedwait,os_event::timed_wait,os_event::wait_time_low,buf_flush_page_cleaner_coordinator,start_thread,clone
      1 nanosleep,os_thread_sleep,srv_master_thread,start_thread,clone
      1 do_sigwaitinfo,__GI___sigwaitinfo,::??,start_thread,clone
      1 do_sigwait,__sigwait,signal_hand,pfs_spawn_thread,start_thread,clone
      1 __lll_lock_wait,_L_lock_909(libpthread.so.0),__GI___pthread_mutex_lock,_myisam_log_command,mi_extra,mi_open_share,ha_myisam::open,handler::ha_open,open_table_from_share,open_table,open_tables,open_and_lock_tables,mysql_execute_command,mysql_parse,::??,handle_bootstrap,pfs_spawn_thread,start_thread,clone

How to repeat:
docker run --cap-add sys_ptrace --rm  -it -e MYSQL_ALLOW_EMPTY_PASSWORD=1 --name lp1713475 mysql:5.7 --log-isam=myisam.log --myisam_use_mmap=1
apt-get update;apt-get install -y gdb

gdb --batch -ex 'set pagination off' -ex 'thr app all bt' -ex detach /usr/sbin/mysqld -p $(pgrep -xn mysqld)

Thread 2 (Thread 0x7f00eeffd700 (LWP 60)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007f0110992479 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007f01109922a0 in __GI___pthread_mutex_lock (mutex=0x1ea7ce0 <THR_LOCK_myisam>) at ../nptl/pthread_mutex_lock.c:79
#3  0x0000000001231e9c in _myisam_log_command ()
#4  0x000000000122e2dd in mi_extra ()
#5  0x0000000001238497 in mi_open_share ()
#6  0x000000000121492c in ha_myisam::open(char const*, int, unsigned int) ()
#7  0x00000000007f8963 in handler::ha_open(TABLE*, char const*, int, int) ()
#8  0x0000000000cf212c in open_table_from_share(THD*, TABLE_SHARE*, char const*, unsigned int, unsigned int, unsigned int, TABLE*, bool) ()
#9  0x0000000000c027a4 in open_table(THD*, TABLE_LIST*, Open_table_context*) ()
#10 0x0000000000c098e6 in open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) ()
#11 0x0000000000c09fd4 in open_and_lock_tables(THD*, TABLE_LIST*, unsigned int, Prelocking_strategy*) ()
#12 0x0000000000c582de in mysql_execute_command(THD*, bool) ()
#13 0x0000000000c5b4cd in mysql_parse(THD*, Parser_state*) ()
#14 0x00000000007c7d98 in ?? ()
#15 0x00000000007c823c in handle_bootstrap ()
#16 0x0000000000e9e894 in pfs_spawn_thread ()
#17 0x00007f0110990064 in start_thread (arg=0x7f00eeffd700) at pthread_create.c:309
#18 0x00007f010f45362d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

ls -l /var/lib/mysql/myisam.log 
-rw-r-----. 1 mysql mysql 0 Oct  5 04:04 /var/lib/mysql/myisam.log
[5 Oct 2017 6:21] MySQL Verification Team
Hello Nikolai,

Thank you for the report and feedback!

Thanks,
Umesh
[5 Oct 2017 6:24] MySQL Verification Team
test results - 5.7.19

Attachment: 87984_5.7.19.results (application/octet-stream, text), 35.80 KiB.