Bug #40766 mysqld crashes if Falcon is started with non-existing serial log directory
Submitted: 16 Nov 2008 22:09 Modified: 30 Sep 2010 17:55
Reporter: Olav Sandstå Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:6.0.8-alpha, 6.0.9-bzr OS:Any
Assigned to: CPU Architecture:Any
Tags: F_HANDLER

[16 Nov 2008 22:09] Olav Sandstå
Description:
When trying to initialize a MySQL database using mysql_install_db and specifying a non-existing directory for Falcon's serial log using the --falcon_serial_log_dir the mysqld process crashes with the following written to the terminal:

Installing MySQL system tables...
081116 22:17:00 [Note] Falcon: unable to open system data files.
081116 22:17:00 [Note] Falcon: creating new system data files.
081116 22:17:00 [ERROR] Falcon: create database failed : can't open file "/tmp/mysql-log/falcon/falcon_master.fl1": No such file or directory (2) 
prior open database failure was: can't open file "/tmp/mysqldb/falcon_master.fts": No such file or directory (2)
081116 22:17:00 [ERROR] Plugin 'Falcon' init function returned error.
081116 22:17:00 [ERROR] Plugin 'Falcon' registration as a STORAGE ENGINE failed.
081116 22:17:00 - 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.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

How to repeat:
How to repeat:
==============

Run mysql_install_db with --falcon_serial_log_dir pointing to a non-existing directory, e.g:

  mysql_install_db --no-defaults --srcdir=/home/olav/mysql --datadir=/tmp/data --falcon_page_cache_size=50M --falcon_record_memory_max=50M --falcon_serial_log_dir=/tmp/log/falcon --falcon-debug-mask=2

Suggested fix:
MySQL should not crash when the directory for the serial log does not exist. An error message should be written by Falcon and the Falcon storage engine should not be used by MySQL.
[16 Nov 2008 22:11] Olav Sandstå
Call stack from the crash:
==========================

(gdb) where
#0  0xb7fa0410 in __kernel_vsyscall ()
#1  0xb7f83ae7 in pthread_kill () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x085d1734 in my_write_core (sig=11) at stacktrace.c:307
#3  0x0823ed97 in handle_segfault (sig=11) at mysqld.cc:2667
#4  <signal handler called>
#5  intern_plugin_lock (lex=0x912e1d0, rc=0x87c0d20) at sql_plugin.cc:621
#6  0x083da39d in plugin_lock (thd=0x912d080, ptr=0xb6c45574)
    at sql_plugin.cc:659
#7  0x0834216b in ha_lock_engine (thd=0x912d080, hton=0xb6c46790)
    at handler.cc:167
#8  0x08342238 in ha_resolve_by_legacy_type (thd=0x912d080, 
    db_type=DB_TYPE_MYISAM) at handler.cc:190
#9  0x08342276 in ha_checktype (thd=0x912d080, database_type=DB_TYPE_MYISAM, 
    no_substitute=true, report_error=false) at handler.cc:206
#10 0x0825f839 in sys_var_thd_storage_engine::check (this=0x8784360, 
    thd=0x912d080, var=0x913dbd8) at set_var.cc:4042
#11 0x0825525a in set_var::check (this=0x913dbd8, thd=0x912d080)
    at set_var.cc:3880
#12 0x0825eaaa in sql_set_variables (thd=0x912d080, var_list=0x912e7a4)
    at set_var.cc:3787
#13 0x08250da9 in mysql_execute_command (thd=0x912d080) at sql_parse.cc:3391
#14 0x08251343 in mysql_parse (thd=0x912d080, 
    inBuf=0x913daa8 "set storage_engine=myisam", length=25, 
---Type <return> to continue, or q <return> to quit---
    found_semicolon=0xb6c45fb4) at sql_parse.cc:5719
#15 0x08251857 in handle_bootstrap (arg=0x912d080) at sql_parse.cc:491
#16 0xb7f7e4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#17 0xb7d84e5e in clone () from /lib/tls/i686/cmov/libc.so.6
(gdb) where
#0  0xb7fa0410 in __kernel_vsyscall ()
#1  0xb7f83ae7 in pthread_kill () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x085d1734 in my_write_core (sig=11) at stacktrace.c:307
#3  0x0823ed97 in handle_segfault (sig=11) at mysqld.cc:2667
#4  <signal handler called>
#5  intern_plugin_lock (lex=0x912e1d0, rc=0x87c0d20) at sql_plugin.cc:621
#6  0x083da39d in plugin_lock (thd=0x912d080, ptr=0xb6c45574)
    at sql_plugin.cc:659
#7  0x0834216b in ha_lock_engine (thd=0x912d080, hton=0xb6c46790)
    at handler.cc:167
#8  0x08342238 in ha_resolve_by_legacy_type (thd=0x912d080, 
    db_type=DB_TYPE_MYISAM) at handler.cc:190
#9  0x08342276 in ha_checktype (thd=0x912d080, database_type=DB_TYPE_MYISAM, 
    no_substitute=true, report_error=false) at handler.cc:206
#10 0x0825f839 in sys_var_thd_storage_engine::check (this=0x8784360, 
    thd=0x912d080, var=0x913dbd8) at set_var.cc:4042
#11 0x0825525a in set_var::check (this=0x913dbd8, thd=0x912d080)
    at set_var.cc:3880
#12 0x0825eaaa in sql_set_variables (thd=0x912d080, var_list=0x912e7a4)
    at set_var.cc:3787
#13 0x08250da9 in mysql_execute_command (thd=0x912d080) at sql_parse.cc:3391
#14 0x08251343 in mysql_parse (thd=0x912d080, 
    inBuf=0x913daa8 "set storage_engine=myisam", length=25, 
    found_semicolon=0xb6c45fb4) at sql_parse.cc:5719
#15 0x08251857 in handle_bootstrap (arg=0x912d080) at sql_parse.cc:491
#16 0xb7f7e4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#17 0xb7d84e5e in clone () from /lib/tls/i686/cmov/libc.so.6
[16 Nov 2008 22:29] Olav Sandstå
This crash does not happen in Falcon code but it happens just after Falcon have been loaded and in a situation where the initialization of Falcon fails. In this case Falcon's  StorageInterface::falcon_init() method has been called and due to the problem with the serial log directory this methods returns with:

  DBUG_RETURN(1);

The same crash can also be triggered by other situations where the call to StorageInterface::falcon_init() returns 1 (e.g. if Falcon has been compiled without support for C++ exceptions).
[16 Nov 2008 22:33] Olav Sandstå
The crash can also be re-produced starting mysql-test-run when specifying a non-existing serial log directory:

./mysql-test-run.pl --suite=falcon --mysqld="--falcon_serial_log_dir=/tmp/tull"
[17 Nov 2008 9:23] Olav Sandstå
Note that there is a similar bug with a similiar crash reported against 5.1: bug #40757 "Starting server on Windows with innodb_flush_method=wrong_value causes crash". This is currently classified as an InnoDB bug. The crash reported in this bug report happens without having InnoDB in the mysqld binaries.
[17 Nov 2008 16:44] Valeriy Kravchuk
Verified just as described in the last comment with recent 6.0.9 from bzr.