Bug #16984 Events: running out of threads
Submitted: 31 Jan 2006 18:42 Modified: 10 Feb 2006 20:33
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.1.6-alpha-debug OS:Linux (SUSE 10.0)
Assigned to: Andrey Hristov CPU Architecture:Any

[31 Jan 2006 18:42] Peter Gulutzan
Description:
I create an event which has an INSERT DELAYED statement.
There are no other events.
After a while, usually less than 1000 iterations, mysqld says
that it has problems creating a thread, and stops the event
scheduler.

How to repeat:
/* assume default database is db1 */

mysql> create table t1 (s1 int);
Query OK, 0 rows affected (0.01 sec)

mysql> create event e1 on schedule every 1 second do insert delayed into db1.t1 values (0);
Query OK, 1 row affected (0.01 sec)

mysql> set global event_scheduler = 1;
Query OK, 0 rows affected (0.00 sec)

Now mysqld should start displaying
 "EVEX EXECUTED event db1.e1  [EXPR:1]. RetCode=0"
but eventually it will say:

060131 11:31:28 [ERROR] Problem while trying to create a thread
060131 11:31:28 [Note] Event scheduler stopping. Waiting for worker threads to finish.
060131 11:31:29 [Note] Event scheduler stopped.
[31 Jan 2006 22: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/1966
[9 Feb 2006 20:39] Andrey Hristov
Fixed in 5.1.7 
With 5.1.6 no more than 1000-1500 executions off all defined events can be done. The threads are not detached so every activate event counts against the number of SQL server threads. SQL threads detach themselves. This may lead to situation where the server has to be restarted.
[10 Feb 2006 20:33] Paul DuBois
Bug appears only in unreleased code. No changelog
entry needed.
[8 Sep 2006 15:32] Jason Buck
I'm seeing exactly this behaviour in 5.1.11-beta.  Same event scenario, same log messages/sequence. 
Usually after only a few hundred iterations of the event.
This fix was certainly rolled forward into 5.1.11?  Are there any further fixes due for this?