Bug #43201 sp-error.test fails on Windows debug build in embedded mode
Submitted: 25 Feb 2009 17:06 Modified: 14 Mar 2010 1:01
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S2 (Serious)
Version:6.0 OS:Windows (debug build)
Assigned to: Vladislav Vaintroub CPU Architecture:Any

[25 Feb 2009 17:06] Ingo Strüwing
Description:
On a Windows debug build in embedded mode:

main.sp-error                            [ fail ]
        Test ended at 2009-02-22 00:22:14

CURRENT_TEST: main.sp-error
mysqltest got exception 0xc00000fd

read_command_buf at 006A3470=call p1(1)

conn->name at 0039D9B0=

conn->cur_query at 00000000=

Attempting backtrace...

1001A187    LIBMYSQLD.dll!_chkstk()[chkstk.asm:99]

10135D09    LIBMYSQLD.dll!parse_sql()[sql_parse.cc:7719]

102BD549    LIBMYSQLD.dll!sp_compile()[sp.cc:547]

102BD209    LIBMYSQLD.dll!db_load_routine()[sp.cc:632]

102BC785    LIBMYSQLD.dll!sp_find_routine()[sp.cc:1278]

1012EEDE    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4187]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

102A28FF    LIBMYSQLD.dll!sp_head::execute_procedure()[sp_head.cc:1983]

1012F06E    LIBMYSQLD.dll!mysql_execute_command()[sql_parse.cc:4247]

102A5C00    LIBMYSQLD.dll!sp_instr_stmt::exec_core()[sp_head.cc:2921]

102A4F8E    LIBMYSQLD.dll!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:2745]

102A5364    LIBMYSQLD.dll!sp_instr_stmt::execute()[sp_head.cc:2858]

102A0D38    LIBMYSQLD.dll!sp_head::execute()[sp_head.cc:1248]

Writing a core file...

Minidump written to C:\cygwin\home\istruewing\bzrroot\mysql-6.0-wl4534-8\mysql-test\mysqltest_embedded.dmp

How to repeat:
Make a debug build on Windows.
Run the mentioned test.
[25 Feb 2009 18:21] Vladislav Vaintroub
Exception code 0xc00000fd is stack overflow
[20 Feb 2010 23:16] 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/commits/100983

3094 Vladislav Vaintroub	2010-02-21
      Bug#43201 : Stack overrun when running sp-error test.
      It appears that stack overflow checks for recusrive stored procedure
      calls, that run in the normal server, did not work in embedded and were
      dummified with preprocessor magic( #ifndef EMBEDDED_SERVER ).
      
      The fix is to remove ifdefs, there is no reason not to run overflow checks
      and crash in deeply recursive calls. 
      
      Note: Start of the stack (thd->thread_stack variable) in embedded is not necessarily
      exact but stil provides the best guess. Unless the caller of mysql_read_connect()
      is already deep in the stack, thd->thread_stack variable should approximate stack 
      start address well.
[23 Feb 2010 11:49] 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/commits/101186

3099 Vladislav Vaintroub	2010-02-23
      Bug#43201 : Stack overrun when running sp-error test.
      It appears that stack overflow checks for recusrive stored procedure
      calls, that run in the normal server, did not work in embedded and were
       dummified with preprocessor magic( #ifndef EMBEDDED_SERVER ).
            
       The fix is to remove ifdefs, there is no reason not to run overflow checks
       and crash in deeply recursive calls. 
            
       Note: Start of the stack (thd->thread_stack variable) in embedded is not
      necessarily exact but stil provides the best guess. Unless the caller of 
      mysql_read_connect()   is already deep in the stack, thd->thread_stack 
      variable should approximate stack  start address well.
[23 Feb 2010 19:28] 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/commits/101248

2980 Vladislav Vaintroub	2010-02-23
      Bug#43201: Post-fix.  Set thread stack address at the start of each query.
      
      Reason: implementation of send/reap in mysqltest uses the same "embedded" connection in a thread different from current, so thread stack has to change when connection is used in different  OS thread..
[25 Feb 2010 19:47] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100225194420-p60r4u90tszj8q2x) (version source revid:wlad@sun.com-20100223200354-0b9k5wroq5frqoyd) (merge vers: 6.0.14-alpha) (pib:16)
[25 Feb 2010 19:49] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100225194305-h49uyjrlfl3mwo60) (version source revid:wlad@sun.com-20100223192538-is2877eg074f925p) (pib:16)
[6 Mar 2010 10:57] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:alik@sun.com-20100225195857-farb6yvy8x06bylj) (merge vers: 5.5.99-m3) (pib:16)
[14 Mar 2010 1:01] Paul DuBois
Noted in 5.5.3, 6.0.14 changelogs.

In the embedded server, stack overflow checks for recursive stored
procedure calls did not work and stack overflow could occur.