Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
Submitted: 2 Mar 2007 21:40 Modified: 24 Mar 2007 6:31
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S2 (Serious)
Version:5.1.17BK, 5.2.4BK OS:Linux (suse 9.3 x86)
Assigned to: Kristofer Pettersson CPU Architecture:Any
Tags: crash, Event

[2 Mar 2007 21:40] Shane Bester
Description:
this crashes the server:
set global event_scheduler=1;

Version: '5.1.17-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  yes
070302 23:20:47 [Note] SCHEDULER: Manager thread started with id 3
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=1
max_threads=151
threads_connected=2
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 337597 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x8dea480
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0x42896ffc, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x81f4d31 handle_segfault + 689
0x83c05b8 _ZN11Event_queue28recalculate_activation_timesEP3THD + 184
0x83b733b _ZN15Event_scheduler3runEP3THD + 123
0x83b86e6 event_scheduler_thread + 406
0x4004daa7 _end + 931859575
0x4017ec2e _end + 933109246
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/using-stack-trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do 
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at (nil)  is invalid pointer
thd->thread_id=3
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.

How to repeat:
set global event_scheduler=1;

Suggested fix:
.
[2 Mar 2007 22:14] Andrey Hristov
Shane, please provide a dump of your mysql.event table. Can you reproduce it? Can you try to run it in gdb and take a trace from there and probably inspect few variables here and there in the stack. That would be nice! :)

Andrey
[2 Mar 2007 23:16] MySQL Verification Team
clean install, rm -rf ./data followed by ./scripts/mysql_install_db
bk pull from about 2 days ago.  will try catch it in a debugger and post it later.
[2 Mar 2007 23:56] MySQL Verification Team
server must be started with --skip-grant-tables to cause this crash to occur :)
[16 Mar 2007 11:57] Kristofer Pettersson
Quickly resolved by Andrey: the program crashes because Event engine isn't initialized if opt_noacl. 

Easier-to-read stack trace:
	mysqld.exe!Event_queue::lock_data(const char * func=0x00b035b0, unsigned int line=440)  Line 651 + 0x6 bytes	C++
 	mysqld.exe!Event_queue::recalculate_activation_times(THD * thd=0x0215cf50)  Line 441	C++
 	mysqld.exe!Event_scheduler::run(THD * thd=0x0215cf50)  Line 512	C++
 	mysqld.exe!event_scheduler_thread(void * arg=0x0215eee8)  Line 236	C++

Patch is to mark Event engine as disabled in case of opt_noacl.
[16 Mar 2007 13:57] 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/22129

ChangeSet@1.2443, 2007-03-16 14:57:02+01:00, thek@kpdesk.mysql.com +4 -0
  Bug#26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
  
  - Crash occured because Event engine is only initialized if
    ACLs are used but not properly marked as disabled.
  - The patch is to mark the Event engine as DISABLED if no ACLs
    are used to avoid access of uninitialized variables.
[22 Mar 2007 21:24] Konstantin Osipov
Fixed in 5.1.17
[24 Mar 2007 6:31] 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 fix in 5.1.17 changelog. Noted new behaviour in description of --skip-grant-tables & event_scheduler in 5.1 Manual.