Bug #17619 Scheduler race conditions
Submitted: 21 Feb 2006 15:49 Modified: 23 May 2006 23:55
Reporter: Andrey Hristov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.1.8 OS:Linux (SuSE 9.3)
Assigned to: Andrey Hristov

[21 Feb 2006 15:49] Andrey Hristov
Description:
The event scheduler has race conditions. They lead to crashes and incorrect results in the test suite as well during normal usage.

How to repeat:
Use the test suite
[28 Feb 2006 15: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/3247
[16 Mar 2006 14:41] Andrey Hristov
Moving back to verified because has to push other pending code.
[28 Mar 2006 11:57] Andrey Hristov
already working on it
[29 Mar 2006 15:42] 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/4281
[29 Mar 2006 15:43] Andrey Hristov
Back to progress, committed a preliminary patch
[4 Apr 2006 20:43] 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/4461
[7 Apr 2006 14:58] 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/4647
[9 Apr 2006 21:56] 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/4688
[9 Apr 2006 22:13] 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/4689
[13 Apr 2006 13:26] 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/4920
[20 Apr 2006 11:42] 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/5202
[20 Apr 2006 15:19] 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/5211
[21 Apr 2006 11:55] 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/5292
[21 Apr 2006 11:58] 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/5293
[25 Apr 2006 14:42] 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/5483
[2 May 2006 7: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/5785
[11 May 2006 10: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/6243
[11 May 2006 10:56] 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/6244
[11 May 2006 15:30] 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/6253
[12 May 2006 9:41] 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/6291
[15 May 2006 17:23] 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/6402
[15 May 2006 21:10] 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/6414
[16 May 2006 8: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/6447
[16 May 2006 8:39] 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/6450
[16 May 2006 16:58] 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/6472
[16 May 2006 17: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/6475
[16 May 2006 21:40] 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/6486
[18 May 2006 10:00] 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/6557
[18 May 2006 14:15] 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/6570
[18 May 2006 15:22] 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/6571
[18 May 2006 17:06] 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/6576
[23 May 2006 7:37] Andrey Hristov
Will be available in 5.1.11.
Various race conditions were removed from the Scheduler's code which improve the stability. Setting of GLOBAL event_scheduler is since now synchronous, was asynchronous. 

Introduced is the concept of suspending and resuming the scheduler :
mysqld --event-scheduler=OFF|0  <-- the scheduler will be unavailable
mysqld --event-scheduler=ON|1   <-- the scheduler will be available and event execution will start right after the server is started
mysqld --event-scheduler=SUSPEND|2  <-- the scheduler is available but no execution will take place till the scheduler is resumed

During runtime GLOBAL event_scheduler can have 3 states -> 0 | 1 | 2 
SET GLOBAL EVENT_SCHEDULER=2;  <--works
SET GLOBAL EVENT_SCHEDULER='SUSPEND'; <-- does not work (not implemented)
If the server was started with --event-scheduler=0 setting the global variable to 1 or 2 during runtime will result in an error. Moreover if the server was started with initialized scheduler then setting EVENT_SCHEDULER global to 0 will result in an error.

When the scheduler is suspended it's process is still running. It is not possible to kill this process. Any try to do it with the KILL command will result in the scheduler being suspended. To resume it do set global event_scheduler=1; The process will be stopped at server end.
[23 May 2006 23:55] 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
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented feature change in 5.1.11 changelog and Events chapter of 5.1 Manual. Closed.