Bug #22397 Events: crash with procedure which alters events
Submitted: 15 Sep 2006 16:37 Modified: 2 Oct 2006 13:49
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.1.12-beta-debug OS:Linux (SUSE 10.0 / 64-bit)
Assigned to: Andrey Hristov CPU Architecture:Any

[15 Sep 2006 16:37] Peter Gulutzan
Description:
I create a procedure which alters an event.
The alteration refers to a variable which is NULL.
Crash.

I was inspired by the fix for
Bug#16409 Events: can't drop procedure containing CREATE EVENT statement
which has made it almost impossible to do bad things
with events and procedures, but ALTER is still possible
if there is no "body".

How to repeat:
mysql> create event e_16 on schedule every 1 second do set @a=5;
Query OK, 0 rows affected (0.02 sec)

mysql> create procedure p_16 () alter event e_16 on schedule every @a second;
Query OK, 0 rows affected (0.01 sec)

mysql> set @a = null;
Query OK, 0 rows affected (0.00 sec)

mysql> call p_16();
ERROR 2013 (HY000): Lost connection to MySQL server during query
[16 Sep 2006 11:43] Valeriy Kravchuk
Thank you for a bug report. Verified just as described with 5.1.12-BK (ChangeSet@1.2330, 2006-09-16 07:19:42+02:00) on Linux. It is S1 bug, as we have a crash here.
[22 Sep 2006 16:25] 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/12419

ChangeSet@1.2316, 2006-09-22 18:23:53+02:00, andrey@example.com +3 -0
  Fix for bug#22397 Events: crash with procedure which alters events
  
  ALTER EVENT in stored procedure body led to a crash during the
  procedure call. Affected was only ALTER EVENT which changed the
  interval of the event. No problems with AT, STARTS, ENDS and so on.
[25 Sep 2006 14:51] 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/12478

ChangeSet@1.2319, 2006-09-25 16:49:25+02:00, andrey@example.com +3 -0
  Fix for bug#22397 Events: crash with procedure which alters events
    
  ALTER EVENT in stored procedure body led to a crash during the
  procedure call. Affected was only ALTER EVENT which changed the
  interval of the event. No problems with AT, STARTS, ENDS and so on.
[28 Sep 2006 9:59] Petr Chardin
Pushed to 5.1.12
[2 Oct 2006 13:49] 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 bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.12 changelog.