Crash Mysql 5.0 - Stored Procedure

Crash Mysql 5.0 - Stored Procedure

am 02.02.2004 07:06:30 von Szymon Okraska

Hi

Sorry for my english :(

Example of stored procedure:


Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.0-alpha-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> DELIMITER |
mysql> DROP PROCEDURE IF EXISTS crash|
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE PROCEDURE crash()
-> BEGIN
-> DROP TABLE IF EXISTS test.c1;
-> CREATE TABLE test.c1 (id INT DEFAULT '0' NOT NULL);
-> INSERT INTO test.c1 select 12;
-> END|
Query OK, 0 rows affected (0.00 sec)

mysql> DELIMITER ;
mysql> call crash();
Query OK, 0 rows affected (0.01 sec)

mysql> call crash();
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

It's happend on debian linux and windows xp;

Any sugestion ?
If I use select in insert it crash server.


Szymon Okraska

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: Crash Mysql 5.0 - Stored Procedure

am 02.02.2004 19:07:27 von Sinisa Milivojevic

Szymon Okraska writes:
> Hi
>
> Sorry for my english :(
>
> Example of stored procedure:
>
>
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
>
> Welcome to the MySQL monitor. Commands end with ; or \g.
> Your MySQL connection id is 1 to server version: 5.0.0-alpha-standard
>
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
> mysql> DELIMITER |
> mysql> DROP PROCEDURE IF EXISTS crash|
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> CREATE PROCEDURE crash()
> -> BEGIN
> -> DROP TABLE IF EXISTS test.c1;
> -> CREATE TABLE test.c1 (id INT DEFAULT '0' NOT NULL);
> -> INSERT INTO test.c1 select 12;
> -> END|
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> DELIMITER ;
> mysql> call crash();
> Query OK, 0 rows affected (0.01 sec)
>
> mysql> call crash();
> ERROR 2013 (HY000): Lost connection to MySQL server during query
> mysql>
>
> It's happend on debian linux and windows xp;
>
> Any sugestion ?
> If I use select in insert it crash server.
>
>
> Szymon Okraska
>
> --
> MySQL Bugs Mailing List
> For list archives: http://lists.mysql.com/bugs
> To unsubscribe: http://lists.mysql.com/bugs?unsub=sinisa@cytanet.com.cy
>

Hi!

Thank you for your fine report.

It truly crashes MySQL 5.0.

This is such a nice report, that I have fixed it quite fast.

Patch is already proposed that shuold fix a problem.

This is a proposed, and not yet final, patch:
===== sql/sp_head.cc 1.64 vs edited =====
*** /tmp/sp_head.cc-1.64-4485 Mon Jan 26 16:17:32 2004
--- edited/sql/sp_head.cc Mon Feb 2 19:50:42 2004
***************
*** 853,868 ****
TABLE_LIST *tabs;

// We have closed all tables, get rid of pointers to them
for (tabs=(TABLE_LIST *)sl->table_list.first ;
tabs ;
tabs= tabs->next)
{
tabs->table= NULL;
- }
- if (lex->sql_command == SQLCOM_CREATE_TABLE ||
- lex->sql_command == SQLCOM_INSERT_SELECT)
- { // Restore sl->table_list.first
- sl->table_list.first= sl->table_list_first_copy;
}
for (ORDER *order= (ORDER *)sl->order_list.first ;
order ;
--- 853,868 ----
TABLE_LIST *tabs;

// We have closed all tables, get rid of pointers to them
+ if (lex->sql_command == SQLCOM_CREATE_TABLE ||
+ lex->sql_command == SQLCOM_INSERT_SELECT)
+ { // Restore sl->table_list.first
+ sl->table_list.first= sl->table_list_first_copy;
+ }
for (tabs=(TABLE_LIST *)sl->table_list.first ;
tabs ;
tabs= tabs->next)
{
tabs->table= NULL;
}
for (ORDER *order= (ORDER *)sl->order_list.first ;
order ;



--

Sincerely,

--
For technical support contracts, go to https://order.mysql.com/?ref=msmi
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB
/_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator
<___/ www.mysql.com Larnaca, Cyprus

Want to swim with the dolphins? (April 14-16, 2004)
http://www.mysql.com/uc2004/


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org