Bug #52765 killing "drop function if exists" causes debug assert
Submitted: 12 Apr 2010 12:23 Modified: 11 Jun 2012 16:39
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1.45-debug, 5.1 bzr OS:Any (Windows XP, Linux)
Assigned to: Jon Olav Hauglid CPU Architecture:Any

[12 Apr 2010 12:23] Shane Bester
Description:
Assertion failed: ! is_set(), file .\sql_class.cc, line 468

mysqld-debug.exe!my_sigabrt_handler()[mysqld.cc:2047]
mysqld-debug.exe!raise()[winsig.c:597]
mysqld-debug.exe!abort()[abort.c:78]
mysqld-debug.exe!_wassert()[assert.c:212]
mysqld-debug.exe!Diagnostics_area::set_ok_status()[sql_class.cc:468]
mysqld-debug.exe!my_ok()[sql_class.h:2355]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:4576]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5975]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1235]
mysqld-debug.exe!do_command()[sql_parse.cc:874]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1127]
mysqld-debug.exe!pthread_start()[my_winthread.c:85]
mysqld-debug.exe!_callthreadstart()[thread.c:295]
mysqld-debug.exe!_threadstart()[thread.c:277]
kernel32.dll!BaseThreadStart()

Some pointers may be invalid and cause the dump to abort...
thd->query at 0000000006509318=drop function if exists `f_61`
thd->thread_id=235
thd->killed=KILL_CONNECTION

How to repeat:
it's not easy to repeat.  run a debug server.
in one thread create/drop functions, reconnecting whenever killed.
in another thread quickly kill the first thread.
[13 Apr 2010 6:40] Sveta Smirnova
Thank you for the report.

Verified as described.

To repeat:

In 1 terminal run

while true; do ./bin/mysql -uroot -S /tmp/mysql_ssmirnova.sock test <./bug52765.sql; done

$head bug52765.sql
drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
create function f1() returns int return 1; drop function if exists f1;
...
$wc -l bug52765.sql
33826 bug52765.sql

In second terminal open mysql command line client, then issue SHOW PROCESSLIST, then KILL until server crashes.
[13 Apr 2010 7:48] Sveta Smirnova
To easily repeat bug in second connection use command:

$for i in `seq 1 2 1111`; do ./bin/mysql -uroot -S /tmp/mysql_ssmirnova.sock -e "kill $i"; sleep 1; done