Bug #19403 Crash that happens during removing of database name from cache (#2)
Submitted: 27 Apr 2006 16:46 Modified: 31 Aug 2006 18:53
Reporter: Alexey Stroganov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.1.9 OS:Any (All)
Assigned to: Dmitry Lenev CPU Architecture:Any

[27 Apr 2006 16:46] Alexey Stroganov
Description:
Working on stress testing of 5.1 tree I found  case when mysql server crashes during removing of database name from cache. There was already registered very similar issue(BUG#12212) for mysql 5.0.

test-case:
-----------------------------------------------
drop table if exists tb2;

create table tb2(a1 int);
insert into tb2 values(1);

DROP DATABASE IF EXISTS test1;
CREATE DATABASE test1;

Backtrace:
------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 4508592 (LWP 26353)]
0x005da8c8 in strcmp () from /lib/tls/libc.so.6
(gdb) bt
#0  0x005da8c8 in strcmp () from /lib/tls/libc.so.6
#1  0x0822d6af in remove_db_from_cache (db=0x8eff098 "test1") at sql_base.cc:5866
#2  0x082c7396 in mysql_rm_db (thd=0xb720e8b8, db=0x8eff098 "test1", if_exists=true, silent=false)
    at sql_db.cc:788
#3  0x081fc2b7 in mysql_execute_command (thd=0xb720e8b8) at sql_parse.cc:3694
#4  0x08202399 in mysql_parse (thd=0xb720e8b8, inBuf=0x8eff038 "DROP DATABASE IF EXISTS test1", length=29)
    at sql_parse.cc:5894
#5  0x081f70d3 in dispatch_command (command=COM_QUERY, thd=0xb720e8b8,
    packet=0xb7211ef9 "DROP DATABASE IF EXISTS test1", packet_length=30) at sql_parse.cc:1741
#6  0x081f696f in do_command (thd=0xb720e8b8) at sql_parse.cc:1537
#7  0x081f5989 in handle_one_connection (arg=0xb720e8b8) at sql_parse.cc:1179
#8  0x006e0341 in start_thread () from /lib/tls/libpthread.so.0
#9  0x006396fe in clone () from /lib/tls/libc.so.6

How to repeat:
Run attached  test case
[27 Apr 2006 16:51] Alexey Stroganov
Test suite for reproducing of registerd issue

Attachment: bug19403.tar.gz (application/x-tgz, text), 354 bytes.

[27 Apr 2006 16:53] Alexey Stroganov
Below is instruction how to repeat reported issue.

To run attached test case you need:

1. Unpack attached archive in mysql-test directory 
tar xzfv suite-bug19403.tar.gz

2. Run following command:

./mysql-test-run --stress --stress-threads=10 --stress-test-count=1000 --stress-suite=bug19403 test19403
[30 Apr 2006 1:13] Brian Aker
Please test in 4.1 and 5.0 before verifying.
[30 Apr 2006 5:10] MySQL Verification Team
I was able to repeat only on 5.1BK:

   
   Output of mysqltest:
   mysqltest: At line 8: query 'DROP DATABASE IF EXISTS test1' failed: 2013: Lost connection to MySQL server during query

------------------------------------------------------------------------------------

test_loop[0:1000 0:995]: TID 5 test: 'test19403'  Errors: No Errors. Test Passed OK

test_loop[0:1000 0:1000]: TID 1 test: 'test19403'  Errors: No Errors. Test Passed OK

test_loop[0:1000 0:998]: TID 6 test: 'test19403'  Errors: No Errors. Test Passed OK

test_loop[0:1000 0:999]: TID 10 test: 'test19403'  Errors: No Errors. Test Passed OK

test_loop[0:1000 0:996]: TID 8 test: 'test19403'  Errors: No Errors. Test Passed OK

EXIT
Ending Tests
Shutting-down MySQL daemon

Master shutdown finished
Slave shutdown finished
miguel@hegel:~/dbs/mysql-5.0/mysql-test> 
-----------------------------------------------------------------------------------------

miguel@hegel:~/dbs/mysql-4.1/mysql-test> ./mysql-test-run --stress --stress-threads=10 --stress-test-count=1000 --stress-suite=bug19403 test19403
Logging: ./mysql-test-run --stress --stress-threads=10 --stress-test-count=1000 --stress-suite=bug19403 test19403
Unrecognized option: --stress
[4 Aug 2006 14:21] Konstantin Osipov
Approved by email.
[24 Aug 2006 20:59] Petr Chardin
Pushed to 5.1.12
[31 Aug 2006 18:55] Paul DuBois
Noted in 5.1.12 changelog.

When DROP DATABASE was issued while concurrently issuing DROP TABLE
(or RENAME TABLE, CREATE TABLE LIKE or any other statement that
required a name lock) in another connection, the server crashed.