Bug #11652 calling SP with prepare, execute , destory stmt caused server crash
Submitted: 30 Jun 2005 4:08 Modified: 2 Jul 2005 7:49
Reporter: Paul McArdle Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.7 Beta OS:Any (*)
Assigned to: Konstantin Osipov CPU Architecture:Any

[30 Jun 2005 4:08] Paul McArdle
Description:
is discssed in http://forums.mysql.com/read.php?98,22770

How to repeat:

connected via mysql client localhost

create procedure  getrowcount( in tablename varchar(64), out rowcount bigint ) 
begin 
 declare stmt_exp  varchar(128); 
 set @stmt_exp = concat('select count(*) from ', tablename ); 
 prepare stmt from @stmt_exp ; 
 execute stmt; 
 deallocate prepare stmt; 
end//

Query OK, 0 rows affected (0.08 sec)
 
mysql> call getrowcount('a',@a);
    -> //
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.03 sec)
 
mysql> select @a//
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111
)
ERROR:
Can't connect to the server

from mysqld
 pure virtual method called
mysqld got signal 6;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
 
key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=1
max_connections=100
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
thd=0x89d9c38
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfe5ecd8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x809cc37
0x834a258
0x8355931
0x834a5e9
0x8355d50
0x83ba8c8
0x83ba8ed
0x83ba2cb
0x8177556
0x8177980
0x80b1f2a
0x80b4309
0x80ac7f4
0x80ac124
0x80ab6b4
0x8347a0c
0x837141a
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions
on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8a063a8 = call getrowcount('a',@a)
thd->thread_id=2
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
[root@localhost root]#
[30 Jun 2005 6:25] Aleksey Kishkin
got error on mysqld console:

 -pure virtual function call
[2 Jul 2005 7:49] Konstantin Osipov
mysql> create procedure  getrowcount( in tablename varchar(64), out rowcount bigint ) 
    -> begin 
    ->  declare stmt_exp  varchar(128); 
    ->  set @stmt_exp = concat('select count(*) from ', tablename ); 
    ->  prepare stmt from @stmt_exp ; 
    ->  execute stmt; 
    ->  deallocate prepare stmt; 
    -> end//
ERROR 1314 (0A000): PREPARE is not allowed in stored procedures
mysql> delimiter ;
mysql> select version();
+-------------------------------+
| version()                     |
+-------------------------------+
| 5.0.9-beta-valgrind-max-debug |
+-------------------------------+
1 row in set (0.00 sec)

prepare/deallocate/execute were disabled in stored procedures in 5.0.8.
We will implement support for it in future releases.