Bug #9715 SP crashes MySQL server if query cache is enabled
Submitted: 7 Apr 2005 12:58 Modified: 17 Jun 2005 13:19
Reporter: Victoria Reznichenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0 OS:Any (any)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[7 Apr 2005 12:58] Victoria Reznichenko
Description:
SP crashes MySQL server if query cache is enabled.

mysql> call `dbpos`.`upiaddruntimekeypositions`();
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
Number of processes running now: 0
050407 16:56:12  mysqld restarted

If I disable query cache SP runs like charm.

Back trace:

(gdb) bt
#0  0xb7ceda21 in kill () from /lib/libc.so.6
#1  0xb7e48051 in pthread_kill () from /lib/libpthread.so.0
#2  0xb7e4842b in raise () from /lib/libpthread.so.0
#3  0xb7ced7b4 in raise () from /lib/libc.so.6
#4  0xb7ceec7d in abort () from /lib/libc.so.6
#5  0xb7ce6def in __assert_fail () from /lib/libc.so.6
#6  0x082c4d0a in Query_cache::send_result_to_client (this=0x8852260, thd=0x8eb51e8,
    sql=0x8f1fd40 "select ifnull(max(slsruntimemap.`lindexid`)+1,1)\n \t\t\tinto p_lindexid\n \t\t\tfrom slsruntimemap\n \t\t\twhere slsruntimemap.`lmapid`=p_lmapid", query_length=133)
    at sql_cache.cc:930
#7  0x082faad8 in sp_instr_stmt::execute (this=0x8eeef98, thd=0x8eb51e8, nextp=0xbe3ff16c)
    at sp_head.cc:1356
#8  0x082f88b9 in sp_head::execute (this=0x8eedbb8, thd=0x8eb51e8) at sp_head.cc:558
#9  0x082f927f in sp_head::execute_procedure (this=0x8eedbb8, thd=0x8eb51e8, args=0x8eb567c)
    at sp_head.cc:778
#10 0x081c4162 in mysql_execute_command (thd=0x8eb51e8) at sql_parse.cc:4090
#11 0x081c6d55 in mysql_parse (thd=0x8eb51e8,
    inBuf=0x8ebb248 "call `dbpos`.`upiaddruntimekeypositions`()", length=42) at sql_parse.cc:5149
#12 0x081bd46e in dispatch_command (command=COM_QUERY, thd=0x8eb51e8,
    packet=0x8edc661 "call `dbpos`.`upiaddruntimekeypositions`()", packet_length=43)
    at sql_parse.cc:1647
#13 0x081bcd1d in do_command (thd=0x8eb51e8) at sql_parse.cc:1453
#14 0x081bbea8 in handle_one_connection (arg=0x8eb51e8) at sql_parse.cc:1110
#15 0xb7e4514b in pthread_start_thread () from /lib/libpthread.so.0
#16 0xb7e451df in pthread_start_thread_event () from /lib/libpthread.so.0
#17 0xb7d7850a in clone () from /lib/libc.so.6

How to repeat:
1. Start MySQL server with enabled query cache.
2. Restore database from dump
3. Create stored procedure from sp.sql
4. Run: call `dbpos`.`upiaddruntimekeypositions`();
[7 Apr 2005 13:01] Victoria Reznichenko
Database dump was uploaded to FTP server: bug9715.zip
[13 May 2005 6:05] Oleksandr Byelkin
Thank you for bugreport. But this bug have the same nature as Bug #5963, Yoiu can yse following URL to track down progress in bugfixing:
http://bugs.mysql.com/bug.php?id=5963
[14 Jun 2005 17:41] Oleksandr Byelkin
minimal test suite:

set GLOBAL query_cache_size=1355776;

create table t1 (a int);
insert into t1 values (1),(2);

delimiter //;
CREATE PROCEDURE `p1`()
begin
Declare var1 int;
Declare c1 cursor for select a from t1;

open c1;
select * from t1;

end//

call p1()//
[14 Jun 2005 18:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25992
[14 Jun 2005 19:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25997
[16 Jun 2005 9:49] Stas Nichiporovich
Befor patching server crashed every time such procedure was called. And after pacthing it almost does not crash, but sometimes it do :(
[17 Jun 2005 13:19] Paul Dubois
Noted in 5.0.8 changelog.