Description:
MySQL 5.0 seg-faults if one runs it with missing mysql.proc table and executes simple select which refers to non-existing function.
Backtrace follows:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 147466 (LWP 5368)]
0x081790e8 in my_message_sql (error=1146, str=0xbe7fd7e4 "Table 'mysql.proc' doesn't exist", MyFlags=0) at mysqld.cc:2164
2164 if (thd->lex->current_select &&
(gdb) bt
#0 0x081790e8 in my_message_sql (error=1146, str=0xbe7fd7e4 "Table 'mysql.proc' doesn't exist", MyFlags=0) at mysqld.cc:2164
#1 0x08393f96 in my_error (nr=1146, MyFlags=0) at my_error.c:69
#2 0x081bc749 in frm_error (error=-1098917530, form=0x8b822a0, name=0xbe7fe154 "./mysql/proc", errortype=102) at table.cc:1018
#3 0x081bbbc0 in openfrm (thd=0x8b7b490, name=0xbe7fe154 "./mysql/proc", alias=0x8f8f8f8f <Address 0x8f8f8f8f out of bounds>, db_stat=8231,
prgflag=44, ha_open_flags=0, outparam=0x8b822a0) at table.cc:806
#4 0x081b54c8 in open_unireg_entry (thd=0x8b7b490, entry=0x8b822a0, db=0x83e2f7c "mysql", name=0x842714b "proc", alias=0x842714b "proc",
table_desc=0xbe7fedb4, mem_root=0x8b7b4a4) at sql_base.cc:1566
#5 0x081b4104 in open_table (thd=0x8b7b490, table_list=0xbe7fedb4, mem_root=0x8b7b4a4, refresh=0xbe7fed4f) at sql_base.cc:1018
#6 0x081b5cc1 in open_ltable (thd=0x8b7b490, table_list=0xbe7fedb4, lock_type=TL_READ) at sql_base.cc:1792
#7 0x08297906 in db_find_routine_aux (thd=0x8b7b490, type=1, name=0xbe7ff1d4, ltype=TL_READ, tablep=0xbe7ff02c, opened=0xbe7ff033) at sp.cc:114
#8 0x08297b09 in db_find_routine (thd=0x8b7b490, type=1, name=0xbe7ff1d4, sphp=0xbe7ff1d0) at sp.cc:158
#9 0x0829a694 in sp_cache_functions (thd=0x8b7b490, lex=0x8b7b4d0) at sp.cc:991
#10 0x0818dfe6 in mysql_execute_command (thd=0x8b7b490) at sql_parse.cc:2067
#11 0x08194f5b in mysql_parse (thd=0x8b7b490, inBuf=0x8b96418 "select no_such_function('')", length=146257104) at sql_parse.cc:4656
#12 0x0818ca96 in dispatch_command (command=COM_QUERY, thd=0x8b7b490, packet=0x8b8e3b9 "select no_such_function('')", packet_length=28)
at sql_parse.cc:1503
#13 0x0818c382 in do_command (thd=0x8b7b490) at sql_parse.cc:1311
#14 0x0818b7de in handle_one_connection (arg=0x8f8f8f8f) at sql_parse.cc:1047
#15 0x400750b1 in pthread_start_thread () from /lib/libpthread.so.0
#16 0x4007512f in pthread_start_thread_event () from /lib/libpthread.so.0
#17 0x401df8fa in clone () from /lib/libc.so.6
(gdb)
How to repeat:
mysql> select version();
+-------------------+
| version() |
+-------------------+
| 5.0.2-alpha-debug |
+-------------------+
1 row in set (0.00 sec)
mysql> select * from mysql.proc;
ERROR 1146 (42S02): Table 'mysql.proc' doesn't exist
mysql> select no_such_function('');
ERROR 2013 (HY000): Lost connection to MySQL server during query