diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-04-14 09:30:57 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-04-14 09:30:57 +0200 |
commit | 3ff33e5dc582a2966cd6d337fb18a78c1ae0aabc (patch) | |
tree | cf9664ba3ac8ad02d6777fe12ee4ae9da3041e36 /sql/event_scheduler.cc | |
parent | 34c6fa6db8e04ed56f207803b09d889aea71ddab (diff) | |
download | mariadb-git-3ff33e5dc582a2966cd6d337fb18a78c1ae0aabc.tar.gz |
Bug #52367 Deadlock involving SET GLOBAL EVENT_SCHEDULER = OFF
during rqg_mdl_deadlock test
The problem was that if two connection threads simultaneously tries
to execute "SET GLOBAL EVENT_SCHEDULER = OFF", one of them could
hang waiting for the scheduler to stop.
The first connection thread would kill the event scheduler thread
and then start waiting for it to exit. The second connection thread
would then find the event scheduler thread in the process of exiting
and also wait for it to exit. However, since the event scheduler
thread used signal to wake only one waiting thread, the other connection
thread would be left waiting.
This bug was a regression introduced by the fix for Bug#51160.
Before #51160 it was not possible for two connection threads to
try to stop the event scheduler thread simultaneously.
This patch fixes the problem my making sure the event scheduler
thread uses broadcast to notify all waiters that it is exiting.
No test case added as this would require adding debug sync points
to parts of the code where sync points are currently not used.
The patch has been tested with the non-deterministic test case
from the bug description as well as using the RQG.
Diffstat (limited to 'sql/event_scheduler.cc')
-rwxr-xr-x | sql/event_scheduler.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index 3ceb1597a41..d189a49d482 100755 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (C) 2004, 2010 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mysql_priv.h" #include "events.h" @@ -497,8 +497,8 @@ Event_scheduler::run(THD *thd) deinit_event_thread(thd); scheduler_thd= NULL; state= INITIALIZED; - DBUG_PRINT("info", ("Signalling back to the stopper COND_state")); - mysql_cond_signal(&COND_state); + DBUG_PRINT("info", ("Broadcasting COND_state back to the stoppers")); + mysql_cond_broadcast(&COND_state); UNLOCK_DATA(); DBUG_RETURN(res); |