Bug #12953 | Stored procedures: crash if OPTIMIZE TABLE in function | ||
---|---|---|---|
Submitted: | 2 Sep 2005 16:46 | Modified: | 9 Sep 2005 18:45 |
Reporter: | Peter Gulutzan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.13-beta-debug | OS: | Linux (SUSE 9.2) |
Assigned to: | Alexander Nozdrin | CPU Architecture: | Any |
[2 Sep 2005 16:46]
Peter Gulutzan
[2 Sep 2005 17:00]
MySQL Verification Team
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.13-beta-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> delimiter // mysql> create table t4 (s1 int)// Query OK, 0 rows affected (0.04 sec) mysql> optimize tables t4; -> // +---------+----------+----------+-----------------------------+ | Table | Op | Msg_type | Msg_text | +---------+----------+----------+-----------------------------+ | test.t4 | optimize | status | Table is already up to date | +---------+----------+----------+-----------------------------+ 1 row in set (0.00 sec) mysql> create function f4 () returns int begin optimize tables t4; return 1; -> end// Query OK, 0 rows affected (0.02 sec) mysql> select f4()// ERROR 2027 (HY000): Malformed packet mysql> select f4()// Packets out of order (Found: 5, expected 1) ERROR 2013 (HY000): Lost connection to MySQL server during query mysql> 050902 14:00:52 [Note] /home/miguel/dbs/5.0/libexec/mysqld: ready for connections. Version: '5.0.13-beta-debug' socket: '/tmp/mysql.sock' port: 3306 Source distribution [New Thread 1132456880 (LWP 7091)] mysqld: protocol.cc:833: virtual bool Protocol_simple::store_long(long long int): Assertion `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 || field_types[field_pos] == MYSQL_TYPE_LONG' failed. Program received signal SIGABRT, Aborted. [Switching to Thread 1132456880 (LWP 7091)] 0xffffe410 in ?? () (gdb)
[5 Sep 2005 12:03]
Andrey Hristov
So the problem really is to forbid the usage of OPTIMIZE TABLE inside a function. Also ANALYZE TABLE & co. The problem is that when f4() is executed the Protocol instance is modified because data is sent back to the client which corrupts the packet and where the exception is raised field_pos is 4, not 0, thus referencing non-initialized memory.
[6 Sep 2005 18:52]
Alexander Nozdrin
Fixed in 5.0 tree, currently tagged 5.0.13
[9 Sep 2005 18:45]
Paul DuBois
Noted in 5.0.13 changelog.
[20 Oct 2009 10:47]
ambuj kumar
abc
Attachment: MySQL-Stored-Procedures.pdf (application/pdf, text), 332.63 KiB.