Bug #9937 Crash on call to stored procedure
Submitted: 15 Apr 2005 17:28 Modified: 31 May 2005 11:01
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.4 OS:HP/UX (HP-UX 11.23 (ia64))
Assigned to: Per-Erik Martin CPU Architecture:Any

[15 Apr 2005 17:28] Joerg Bruehe
Description:
Release build of 5.0.4, based on ChangeSet
  1.1893 05/04/13 13:17:39 mskold@mysql.com +1 -0
  Fixed failed merge

Test failure is specific to 'hpita2', occurred in all three test runs there (the other three failed to build or start). Symptom:
=== quote start ===
sp                             [ fail ]

Errors are (from /var/tmp/hpita2-64bit/test/mysql-standard-5.0.4-beta-hp-hpux11.23-ia64-64bit/mysql-test/var/log/mysqltest-time) :
/var/tmp/hpita2-64bit/test/mysql-standard-5.0.4-beta-hp-hpux11.23-ia64-64bit/bin/mysqltest: At line 1662: query 'call fib(20)' failed: 2013: Lost connection to MySQL server during query
(the last lines may be the most important ones)

Ending Tests
=== quote end ===

Due to the crash, subsequent tests encounter a different DB contents and fail: "sp_trans", "system_mysql_db", "system_mysql_db_fix", "view".

How to repeat:
Build + test there.
[11 May 2005 13:07] Per-Erik Martin
This is possibly a duplcate of BUG#6048, although it has not yet been confirmed.
[11 May 2005 14:09] Per-Erik Martin
On my linux:

mysql> call fib(96);
Query OK, 0 rows affected (0.03 sec)

...

mysql> call fib(97);
ERROR 1119 (HY000): Thread stack overrun:  Used: 188984 of a 196608 stack.  Use 'mysqld -O thread_stack=#' to specify a bigger stack if needed
mysql> 

which is the expected result. (Recursion seems to run 90-120 levels before it hits the overrun check on a typical linux box.) Even if the recursion depth is the problem, it should be detected gracefully. (And and having problems with just 20 levels would imply a very tiny stack.)
[26 May 2005 19:08] Per-Erik Martin
This was not a duplicate of BUG#6048.

 This shows up on two ia64 platform, possibly because these particular ones
 seem to get very small thread stacks by default.
 The problem is that the check_stack_overrun() test doesn't work because the
 real stack available is only half the one configured. (This must be a bug
 in the OS, or it's libraries.) So the overrrun check never gets a chance,
 the stack is thrashed long before the presumed limit is reached.
 Fixed by requesting twice the stack size to get the expected size on
 ia64 machines (internally, so 'mysqld -O thread_stack=X' will give you X bytes
of real stack size per thread).

Hard to create a general test case that works cross-platform (since it depends
on the stack size), so the test case that triggered the bug report (fib()) will have
to do.
[27 May 2005 19:03] 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/internals/25335
[31 May 2005 16:35] 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/internals/25405