Bug #13718 server crash
Submitted: 3 Oct 2005 15:26 Modified: 3 Oct 2005 22:51
Reporter: Vladimir Kolesnikov Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S2 (Serious)
Version:5.0.13 rc/5.0 BK source OS:Windows (win xp sp 2/Linux)
Assigned to: CPU Architecture:Any

[3 Oct 2005 15:26] Vladimir Kolesnikov
Description:
I get a MySQL servive crash when try to edit a stored procedure

How to repeat:
1. open MySQL Administrator

2. in the catalogs section select 'test' schema

3. select 'stored procedures' tab

4. push 'create proc' button, give it name 'p1' and body 'select 1;'. I.e. finally you get 
CREATE PROCEDURE `test`.`p1` ()
BEGIN
  select 1;
END

5. save it

6. now push the 'edit procedure' button and change 'select 1' to 'select 2'

7. push the 'execute SQL' button

8. MA freezes for a moment and I get a crash

Suggested fix:
no idea
[3 Oct 2005 15:35] MySQL Verification Team
It is the 5.0.13 an upgrade install over an older one? If yes then
it is bug already reported.

Thanks in adavnce.
[3 Oct 2005 15:48] Vladimir Kolesnikov
I just uninstalled the server, then installed it again to a new dir (with a new datadir). After all it still crashes.
[3 Oct 2005 16:31] MySQL Verification Team
Thank you for the bug report.

051003 13:04:42 [Note] /home/miguel/dbs/5.0/libexec/mysqld: ready for connections.
Version: '5.0.15-rc-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution

<cut>

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1132456880 (LWP 7115)]
0x0859e3cc in my_strcasecmp_utf8 (cs=0x878e0e0, s=0x8639dd3 "information_schema", t=0x0) at ctype-utf8.c:2347
2347      while (s[0] && t[0])
Current language:  auto; currently c
(gdb) bt full
#0  0x0859e3cc in my_strcasecmp_utf8 (cs=0x878e0e0, s=0x8639dd3 "information_schema", t=0x0) at ctype-utf8.c:2347
        uni_plane = (MY_UNICASE_INFO **) 0x878cf00
#1  0x081f32d0 in mysql_execute_command (thd=0x8e38290) at sql_parse.cc:4049
        namelen = 149532008
        name = 0x0
        db = 0x8e63960 '\217' <repeats 200 times>...
        result = 1132453808
        res = false
        result = 0
        lex = (LEX *) 0x8e382d0
        select_lex = (SELECT_LEX *) 0x8e384f4
        slave_fake_lock = false
        fake_prev_lock = (MYSQL_LOCK *) 0x0
        first_table = (TABLE_LIST *) 0x0
        all_tables = (TABLE_LIST *) 0x0
        unit = (SELECT_LEX_UNIT *) 0x8e382e0
        _db_func_ = 0x437fdfc8 ""
        _db_file_ = 0x8e63820 ""
        _db_level_ = 149127856
        _db_framep_ = (char **) 0x437fdfac
#2  0x081f6c91 in mysql_parse (thd=0x8e38290, inBuf=0x8e63830 "CREATE PROCEDURE `p1`()\r\nBEGIN\r\n  select 2;\r\nEND", length=48)
    at sql_parse.cc:5507
        lex = (LEX *) 0x8e382d0
        _db_func_ = 0x87b65c0 "h\207b\b"
        _db_file_ = 0x81ed44d "\203Ä \203=Ôk|\b"
        _db_level_ = 1132453908
        _db_framep_ = (char **) 0x0

Below the MySQL Administrator sequence commands:

051003 13:22:02	      2 Query       show databases
051003 13:22:04	      4 Connect     miguel@192.168.0.33 on 
		      4 Query       SET SESSION interactive_timeout=1000000
		      4 Query       SELECT @@sql_mode
		      4 Query       SET SESSION sql_mode=''
		      4 Query       SET NAMES utf8
		      4 Init DB     test
		      4 Query       SHOW TABLE STATUS
		      4 Quit       
		      5 Connect     miguel@192.168.0.33 on 
		      5 Query       SET SESSION interactive_timeout=1000000
		      5 Query       SELECT @@sql_mode
		      5 Query       SET SESSION sql_mode=''
		      5 Query       SET NAMES utf8
		      5 Init DB     test
		      5 Query       SHOW TABLE STATUS
		      5 Quit       
		      6 Connect     miguel@192.168.0.33 on 
		      6 Query       SET SESSION interactive_timeout=1000000
		      6 Query       SELECT @@sql_mode
		      6 Query       SET SESSION sql_mode=''
		      6 Query       SET NAMES utf8
		      6 Init DB     test
		      6 Query       SHOW PROCEDURE STATUS
		      6 Query       SHOW FUNCTION STATUS
		      6 Quit       
051003 13:22:06	      3 Quit       
051003 13:22:17	      2 Query       CREATE PROCEDURE `test`.`sp1` ()
BEGIN
  select 1;
END
		      7 Connect     miguel@192.168.0.33 on 
		      7 Query       SET SESSION interactive_timeout=1000000
		      7 Query       SELECT @@sql_mode
		      7 Query       SET SESSION sql_mode=''
		      7 Query       SET NAMES utf8
		      7 Init DB     test
		      7 Query       SHOW TABLE STATUS
		      7 Quit       
		      8 Connect     miguel@192.168.0.33 on 
		      8 Query       SET SESSION interactive_timeout=1000000
		      8 Query       SELECT @@sql_mode
		      8 Query       SET SESSION sql_mode=''
		      8 Query       SET NAMES utf8
		      8 Init DB     test
		      8 Query       SHOW TABLE STATUS
		      8 Quit       
		      9 Connect     miguel@192.168.0.33 on 
		      9 Query       SET SESSION interactive_timeout=1000000
		      9 Query       SELECT @@sql_mode
		      9 Query       SET SESSION sql_mode=''
		      9 Query       SET NAMES utf8
		      9 Init DB     test
		      9 Query       SHOW PROCEDURE STATUS
		      9 Query       SHOW CREATE PROCEDURE `test`.`sp1`
		      9 Query       SHOW FUNCTION STATUS
		      9 Quit       
051003 13:22:19	     10 Connect     miguel@192.168.0.33 on 
		     10 Query       SET SESSION interactive_timeout=1000000
		     10 Query       SELECT @@sql_mode
		     10 Query       SET SESSION sql_mode=''
		     10 Query       SET NAMES utf8
		     10 Query       SHOW CREATE PROCEDURE `test`.`sp1`
		     10 Quit       
051003 13:22:24	      2 Query       DROP PROCEDURE IF EXISTS test.sp1
		      2 Query       CREATE PROCEDURE `sp1`()
BEGIN
  select 2;
END
[3 Oct 2005 21:52] Konstantin Osipov
To be able to proceed with this bug report I need a test case that is reproducible outside of MySQL Administrator. Your collaboration with submitting an easy to repeat test case is highly apreicated.
[3 Oct 2005 22:54] MySQL Verification Team
This is duplicate of bug:

http://bugs.mysql.com/bug.php?id=13514

because MA tries to create the SP without to select a database:

051003 13:22:19      10 Connect     miguel@192.168.0.33 on 
                     10 Query       SET SESSION interactive_timeout=1000000
                     10 Query       SELECT @@sql_mode
                     10 Query       SET SESSION sql_mode=''
                     10 Query       SET NAMES utf8
                     10 Query       SHOW CREATE PROCEDURE `test`.`sp1`
                     10 Quit       
051003 13:22:24       2 Query       DROP PROCEDURE IF EXISTS test.sp1
                      2 Query       CREATE PROCEDURE `sp1`()
BEGIN
  select 2;
END

See: CREATE PROCEDURE `sp1`()
instead of CREATE PROCEDURE `test`.`sp1` () and the back trace
shows the same source as the bug above mentioned.