Bug #39308 low memory crash with 'show table status', 'show fields', 'show full columns'
Submitted: 8 Sep 2008 12:55
Reporter: Shane Bester
Status: Analyzing
Category:Server: General Severity:S3 (Non-critical)
Version:5.0.70-debug OS:Any
Assigned to: Shane Bester Target Version:

[8 Sep 2008 12:55] Shane Bester
Description:
some examples of crashes when executing 'show' commands under low memory scenarios.

0x81b7b74 handle_segfault + 836
0x818587f Field::eq_def(Field*) + 31
0x818753b Field_enum::eq_def(Field*) + 27
0x821b128 create_tmp_field 296
0x821bace create_tmp_table 1902
0x830dd2e select_union::create_result_table 142
0x8311174 mysql_derived_prepare + 836
0x8310dca mysql_handle_derived + 90
0x820aca4 open_normal_and_derived_tables + 196
0x82d957b get_all_tables + 715
0x82d7e32 get_schema_tables_result + 322
0x8239138 JOIN::exec() + 5368
0x823abe7 mysql_select+ 359
0x823b5cb handle_select(THD*, st_lex*, select_result*, unsigned long) + 459
0x81d3918 mysql_execute_command(THD*) + 5544
0x81da29f mysql_parse(THD*, char const*, unsigned int, char const**) + 639
0x81dadcd dispatch_command + 1405
0x81dd011 handle_one_connection + 2961
thd->query at 0x894c0a0 = show fields from view_table0

0x81b7b74 handle_segfault + 836
0x847af3c mi_close + 28
0x8216e72 free_tmp_table
0x821bbfb create_tmp_table
0x82e0204 create_schema_table
0x82d81e6 mysql_schema_table
0x820a74c open_tables
0x820ad69 open_and_lock_tables
0x81d38bd mysql_execute_command
0x81da29f mysql_parse
0x81dadcd dispatch_command
0x81dd011 handle_one_connection + 2961
thd->query at 0xa565a78 = show fields from  qa00

0x81b7b74 handle_segfault + 836
0x84a2836 hp_close + 70
0x84a2988 heap_close + 120
0x8216e72 free_tmp_table + 386
0x821bbfb create_tmp_table + 2203
0x82e0204 create_schema_table
0x82d81e6 mysql_schema_table
0x820a74c open_tables
0x820ad69 open_and_lock_tables
0x81d38bd mysql_execute_command
0x81da29f mysql_parse
0x81dadcd dispatch_command
0x81dd011 handle_one_connection + 2961
thd->query at 0x9f73b58 = SHOW TABLE STATUS LIKE 'table0'

How to repeat:
create out of memory condition and run these commands.  use ulimit, or --with-debug=full
build running --safemalloc-mem-limit=12485760 and executing queries that cause out of
memory.   testcase will come later.

Suggested fix:
we should try hard to handle errors gracefully.
[8 Sep 2008 13:39] Shane Bester
Another example:

mysqld-debug.exe!list_add)  Line 34 + 0x8 bytes	C
mysqld-debug.exe!thr_lock_init
mysqld-debug.exe!mi_open
mysqld-debug.exe!ha_myisam::open
mysqld-debug.exe!handler::ha_open
mysqld-debug.exe!open_tmp_table
mysqld-debug.exe!create_tmp_table
mysqld-debug.exe!select_union::create_result_table
mysqld-debug.exe!mysql_derived_prepare
mysqld-debug.exe!mysql_handle_derived
mysqld-debug.exe!open_normal_and_derived_tables
mysqld-debug.exe!get_all_tables
mysqld-debug.exe!get_schema_tables_result
mysqld-debug.exe!JOIN::exec
mysqld-debug.exe!mysql_select
mysqld-debug.exe!handle_select
mysqld-debug.exe!mysql_execute_command
mysqld-debug.exe!mysql_parse
mysqld-debug.exe!dispatch_command
mysqld-debug.exe!do_command
mysqld-debug.exe!handle_one_connection
mysqld-debug.exe!pthread_start

packet	0x07ad7059 "show fields from view_table0"	char *