Bug #41832 Usage of invalid datadir with mysql_install_db causes server crash
Submitted: 2 Jan 2009 20:58 Modified: 12 Mar 2009 14:30
Reporter: Alexey Stroganov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S2 (Serious)
Version:6.0.8-release, 6.0.9-release OS:Linux
Assigned to: Guilhem Bichot CPU Architecture:Any

[2 Jan 2009 20:58] Alexey Stroganov
Description:
Passing datadir without write permissions to mysql_install_db script will cause 
server crash with following back trace:

cd mysql-6.0.9:
./scripts/mysql_install_db --basedir=. --datadir=data/

...

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.

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

thd: 0x933bb00
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 = 0xf5bf9058 thread_stack 0x30c00
./bin/mysqld(my_print_stacktrace+0x2d) [0x86e20cd]
./bin/mysqld(handle_segfault+0x39f) [0x8262d2f]
[0xffffe500]
./bin/mysqld(ha_checktype(THD*, legacy_db_type, bool, bool)+0xf0) [0x8368cb0]
./bin/mysqld(sys_var_thd_storage_engine::check(THD*, set_var*)+0x134) [0x828b734]
./bin/mysqld(set_var::check(THD*)+0x117) [0x8287e67]
./bin/mysqld(sql_set_variables(THD*, List<set_var_base>*)+0x25) [0x8288555]
./bin/mysqld(mysql_execute_command(THD*)+0x201e) [0x827614e]
./bin/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x371) [0x827b021]
./bin/mysqld(handle_bootstrap+0x38e) [0x827b3be]
/lib/libpthread.so.0 [0xf7ecc34b]
/lib/libc.so.6(__clone+0x5e) [0xf7d1465e]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x934cc38 = set storage_engine=myisam
thd->thread_id=1
thd->killed=NOT_KILLED

I've simplified command line that causes crash:

echo "set storage_engine=myisam" | ./bin/mysqld  --bootstrap --basedir=. --datadir=/   --loose-skip-innodb

Command line above works ok in 6.0.7 but fails in 6.0.8/6.0.9

How to repeat:
cd <6.0.9 dir>

echo "set storage_engine=myisam" | ./bin/mysqld  --bootstrap --basedir=. --datadir=/   --loose-skip-innodb
[2 Jan 2009 21:27] MySQL Verification Team
Probably duplicate of bug: http://bugs.mysql.com/bug.php?id=37594.
[23 Jan 2009 8:33] Guilhem Bichot
As this is for the Maria team, moving it to "Maria" category for now, so that it shows up in bugs search.
[12 Mar 2009 14:03] Guilhem Bichot
cannot reproduce anymore; I'll re-test with an old 6.0 (from January) to be sure it's gone.
[12 Mar 2009 14:30] Guilhem Bichot
Indeed it has been fixed between tag:clone-6.0.9-build (with which I can reproduce the failure) and now (with which I cannot). The bugfix was outside of Maria.