Bug #32099 Crash when selecting from INFORMATION_SCHEMA
Submitted: 5 Nov 2007 10:16 Modified: 14 Dec 2007 13:38
Reporter: Jan Lindström Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Information schema Severity:S1 (Critical)
Version:5.1.22-RC OS:Linux
Assigned to: CPU Architecture:Any

[5 Nov 2007 10:16] Jan Lindström
Description:
This appeared while running NIST test suite (file dml167.sql) on multicore system (2x Dual Core AMD Opteron Processor 270):

#0  0x0000003f31509727 in pthread_kill () from /lib64/tls/libpthread.so.0
(gdb) frame 4
#4  0x00000000007737ea in get_schema_key_column_usage_record (thd=0x2b01d82758, tables=0x2af9d58b28, 
table=0x18c2be8, res=false, db_name=0x4629fb90, table_name=0x4629fba0) at sql_show.cc:4550
/home/build/mysql-5.1.22-rc/sql/sql_show.cc:4550:152061:beg:0x7737ea
(gdb) where
#0  0x0000003f31509727 in pthread_kill () from /lib64/tls/libpthread.so.0
#1  0x00000000007aaa40 in write_core (sig=11) at stacktrace.c:240
#2  0x0000000000622de5 in handle_segfault (sig=11) at mysqld.cc:2278
#3  <signal handler called>
#4  0x00000000007737ea in get_schema_key_column_usage_record (thd=0x2b01d82758, tables=0x2af9d58b28, 
table=0x18c2be8, res=false, db_name=0x4629fb90, table_name=0x4629fba0) at sql_show.cc:4550
#5  0x000000000076d3b1 in get_all_tables (thd=0x2b01d82758, tables=0x1c098d0, cond=0x0) at sql_show.c
c:3252
#6  0x0000000000777f71 in get_schema_tables_result (join=0x1d31f98, executed_place=PROCESSED_BY_JOIN_
EXEC) at sql_show.cc:5833
#7  0x000000000068e3b7 in JOIN::exec (this=0x1d31f98) at sql_select.cc:1628
#8  0x00000000006902d7 in mysql_select (thd=0x2b01d82758, rref_pointer_array=0x2b01d843a8, tables=0x1
c098d0, wild_num=0, fields=@0x2b01d842c8, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc
_param=0x0, select_options=2685159936, result=0x1c0a9c8, unit=0x2b01d83db0, select_lex=0x2b01d841c0) 
at sql_select.cc:2271
#9  0x0000000000689f6e in handle_select (thd=0x2b01d82758, lex=0x2b01d83d10, result=0x1c0a9c8, setup_
tables_done_option=0) at sql_select.cc:246
#10 0x0000000000638c6c in execute_sqlcom_select (thd=0x2b01d82758, all_tables=0x1c098d0) at sql_parse
.cc:4539
#11 0x0000000000631f08 in mysql_execute_command (thd=0x2b01d82758) at sql_parse.cc:1883
#12 0x000000000063ab7f in mysql_parse (thd=0x2b01d82758, inBuf=0x1c09398 "-- PASS:0874 If COUNT = 0 \
n\n   SELECT COUNT(DISTINCT CONSTRAINT_CATALOG)\n     FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE", leng
th=118, found_semicolon=0x462a1fb8) at sql_parse.cc:5446
#13 0x0000000000630247 in dispatch_command (command=COM_QUERY, thd=0x2b01d82758, packet=0x2b02430259 
"-- PASS:0874 If COUNT = 0 \n\n   SELECT COUNT(DISTINCT CONSTRAINT_CATALOG)\n     FROM INFORMATION_SC
HEMA.KEY_COLUMN_USAGE", packet_length=119) at sql_parse.cc:953
#14 0x000000000062f8dd in do_command (thd=0x2b01d82758) at sql_parse.cc:712
#15 0x000000000062e1ba in handle_one_connection (arg=0x2b01d82758) at sql_connect.cc:1099
#16 0x0000003f3150610a in start_thread () from /lib64/tls/libpthread.so.0
#17 0x0000003f30ac6003 in clone () from /lib64/tls/libc.so.6
#18 0x0000000000000000 in ?? ()
(gdb) p r_info
$1 = (LEX_STRING *) 0x0
(gdb) 

How to repeat:
This is the query where crash happens:

-- PASS:0874 If COUNT = 0

   SELECT COUNT (DISTINCT CONSTRAINT_CATALOG)
     FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;

Run two NIST test suites concurrently on multi core system.
[5 Nov 2007 10:17] Jan Lindström
NIST test file where crash occurs

Attachment: dml167.sql (text/x-sql), 5.43 KiB.

[12 Dec 2007 19:57] Susanne Ebrecht
Unfortunately, I can't reproduce this on FreeBSD and Ubuntu. What did you do else during the test?
[14 Dec 2007 8:18] Jan Lindström
There was at least two NIST test suites running concurrently in this multi-core system. Additionally, there were some other test suites running but not sure if these affected on this case.
[14 Dec 2007 13:38] Susanne Ebrecht
Jan,

my test machine was a Lenova, IBM ThinkPad T60
$ dmesg
...
CPU: Intel(R) Core(TM)2 CPU         T7200  @ 2.00GHz (1995.02-MHz K8-class CPU)
...
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
...

Ubuntu is on the same machine.

I tried to reproduce this on both: FreeBSD and Ubuntu.
The test runs 5000 times in a loop and I started this loop on 5 connections at the same time.
Also there ran another test suite during that time and I did my usual other work on the database system.
I didn't look exactly to the clock, but the testtime was round about one hour on each system.
At the end, all would be fine, nothing curious happens. The test ran without errors.

I'll set this bug to "Can't repeat". Please, let me know, if this is not ok to you.

Many thanks for taking the time and testing NIST.
[12 Aug 2009 14:20] MySQL Verification Team
Looks the same as bug: http://bugs.mysql.com/bug.php?id=46676.