Bug #1508 mysqld crash while trying to report "Table 'mysql.host' doesn't exist"
Submitted: 9 Oct 2003 6:05 Modified: 22 Oct 2003 10:09
Reporter: Marko Mäkelä Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:4.1.1-bitkeeper OS:Linux (GNU/Linux)
Assigned to: CPU Architecture:Any

[9 Oct 2003 6:05] Marko Mäkelä
mysqld crashes with signal 11 on startup if the system tables are missing:
$ mysqld
mysqld got signal 11;

The crash occurs in function my_message_sql, file mysqld.cc.  The variable "thd" points to an apparently uninitialised data structure, containing many 0xa5a5a5a5 pointers etc.

How to repeat:
$ cat > $HOME/.my.cnf << EOF
$ rm -fr /tmp/test
$ mkdir /tmp/test
$ mysqld

Suggested fix:
Make sure that current_thd is initialised before reporting errors in the function openfrm of the file table.cc.
[9 Oct 2003 10:17] Martin Mokrejs
Could this be related to my bug?

[14 Oct 2003 0:55] Marko Mäkelä
No, this bug looks different - it's probably triggered earlier.
In my "how to reproduce" description, you should also mkdir -p /tmp/test/data.
Here's what happens in gdb:
marko@hundin:~/mysql-4.1> mkdir -p /tmp/test/data
marko@hundin:~/mysql-4.1> gdb sql/mysqld
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-suse-linux"...
(gdb) r
Starting program: /home/marko/mysql-4.1/sql/mysqld
[New Thread 1024 (LWP 22500)]
[New Thread 2049 (LWP 22501)]
[New Thread 1026 (LWP 22502)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 22500)]
0x08102928 in my_message_sql (error=1146,
    str=0xbfffe568 "Table 'mysql.host' doesn't exist", MyFlags=0)
    at mysqld.cc:1878
1878            thd->lex.current_select->no_error && !thd->is_fatal_error)
[22 Oct 2003 10:09] Dean Ellis
I am unable to duplicate this with the latest BitKeeper sources.  "Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist" is reported successfully.