Bug #24427 Stopping event instead of execute. Randomly
Submitted: 19 Nov 2006 12:31 Modified: 22 Dec 2006 9:30
Reporter: Vaclav Vobornik Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.1.12-beta OS:Linux (Linux, kernel 2.6.14.2)
Assigned to: Assigned Account CPU Architecture:Any
Tags: Event, scheduler, server

[19 Nov 2006 12:31] Vaclav Vobornik
Description:
I have very simple query in the event scheduler: "delete from tracker where time < now() - interval 2 day" scheduled every 1 hour. On 5.1.11-beta it worked without any problem. After an upgrade from 5.1.11-beta to 5.1.12-beta the event scheduler started to fail:

----------------------- CUT -----------------------
061119  4:23:45 [Note] SCHEDULER: Loaded 3 events
061119  4:23:45 [Note] SCHEDULER: Manager thread started with id 1
061119  4:30:00 [Note] SCHEDULER: [webtracker.clean of root@localhost] executing in thread 125. Execution 1
061119  4:30:01 [Note] SCHEDULER: [webtracker.clean of root@localhost] executed in thread 125. RetCode=0
061119  5:30:00 [Note] SCHEDULER: [webtracker.clean of root@localhost] executing in thread 893. Execution 2
061119  5:30:00 [Note] SCHEDULER: [webtracker.clean of root@localhost] executed in thread 893. RetCode=0
061119  6:30:00 [Note] SCHEDULER: Serious error during getting next event to execute. Stopping
061119  6:30:00 [Note] SCHEDULER: Stopped
----------------------- CUT -----------------------

I have to use "SET GLOBAL event_scheduler = ON;" after I find this in the log file. Then "mysqladmin debug" produces this output (snip):

----------------------- CUT -----------------------
061119 13:13:08 [Note] SCHEDULER: Manager thread started with id 3881

Memory status:
Non-mmapped space allocated from system: 6791168
Number of free chunks:                   180
Number of fastbin blocks:                0
Number of mmapped regions:               10
Space in mmapped regions:                30535680
Maximum total allocated space:           0
Space available in freed fastbin blocks: 0
Total allocated space:                   6208432
Total free space:                        582736
Top-most, releasable space:              133712
Estimated memory (with thread stack):    37720064

Events status:
LLA = Last Locked At  LUA = Last Unlocked At
WOC = Waiting On Condition  DL = Data Locked

Event scheduler status:
State      : INITIALIZED
Thread id  : 34144777
LLA        : run:479
LUA        : run:483
WOC        : NO
Workers    : 0
Executed   : 0
Data locked: NO

Event queue status:
Element count   : 3
Data locked     : NO
Attempting lock : NO
LLA             : get_top_for_execution_if_time:750
LUA             : get_top_for_execution_if_time:806
WOC             : NO
Next activation : 2006-11-19 11:30:00
----------------------- CUT -----------------------

At 13:30 I got again error:

----------------------- CUT -----------------------
061119 13:30:00 [Note] SCHEDULER: Serious error during getting next event to execute. Stopping
061119 13:30:00 [Note] SCHEDULER: Stopped
----------------------- CUT -----------------------

How to repeat:
Not sure
[22 Nov 2006 9:30] Andrey Hristov
Hi,
does this server has high uptime? I see from the log that the thread id of the scheduler is low 3881, but them mysqladmin debug shows non-sense value:
State      : INITIALIZED
Thread id  : 34144777

I see you are using Linux. Do you compile the server manually? Is it possible to compile it with debugging information included and start the server with --debug? And then provide the contents (gzipped) of /tmp/mysqld.trace as attachment of this bug report? This will be probably of much help diagnosing the problem.

Thank you for your report and cooperation!
[23 Dec 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".