Bug #11394 recursion in SP crash server
Submitted: 16 Jun 2005 17:59 Modified: 7 Jul 2005 16:21
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:5.0 OS:
Assigned to: Dmitry Lenev CPU Architecture:Any

[16 Jun 2005 17:59] Oleksandr Byelkin
Server dies on recursion because many Items are not reenterable

How to repeat:
delimiter |;

create function f5(i int) returns int
  if i <= 0 then
    return 0;
    return (i in (100, 200, f5(i-1), 400));
  end if;

select f5(1)|
select f5(2)|
select f5(3)|
[1 Jul 2005 9:11] Dmitry Lenev

As was discussed on IRC the patch disabling recursion for stored routines was commited:

Later we plan to remove this restriction (by using separate sp_head instance for each recursive routine invocation).
[6 Jul 2005 7:43] Dmitry Lenev
Fixed in 5.0.9
[7 Jul 2005 16:21] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

Documented in 5.0.9 change history; closed.