#At file:///home/acorreia/workspace.sun/repository.mysql.new/bzrwork/bug-55415/mysql-5.5-bugfixing/ based on revid:wlad@stripped
3203 Alfranio Correia 2010-09-03 [merge]
BUG#55415 wait_for_update_bin_log enters a condition but does not leave
In sql/log.c, member function wait_for_update_bin_log, a condition is entered with
THD::enter_cond but is not exited. This might leave dangling references to the
mutex/condition in the per-thread information area.
To fix the problem, we call exit_cond to properly remove references to the mutex,
LOCK_log.
modified:
sql/log.cc
sql/sql_repl.cc
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2010-08-30 08:36:02 +0000
+++ b/sql/log.cc 2010-09-03 13:45:39 +0000
@@ -5284,11 +5284,10 @@ int MYSQL_BIN_LOG::wait_for_update_bin_l
const struct timespec *timeout)
{
int ret= 0;
- const char* old_msg = thd->proc_info;
DBUG_ENTER("wait_for_update_bin_log");
- old_msg= thd->enter_cond(&update_cond, &LOCK_log,
- "Master has sent all binlog to slave; "
- "waiting for binlog to be updated");
+ thd->enter_cond(&update_cond, &LOCK_log,
+ "Master has sent all binlog to slave; "
+ "waiting for binlog to be updated");
if (!timeout)
mysql_cond_wait(&update_cond, &LOCK_log);
else
=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc 2010-07-26 10:52:59 +0000
+++ b/sql/sql_repl.cc 2010-08-04 22:28:28 +0000
@@ -826,6 +826,7 @@ impossible position";
#ifndef DBUG_OFF
ulong hb_info_counter= 0;
#endif
+ const char* old_msg= thd->proc_info;
signal_cnt= mysql_bin_log.signal_cnt;
do
{
@@ -849,12 +850,15 @@ impossible position";
#endif
/* reset transmit packet for the heartbeat event */
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ {
+ thd->exit_cond(old_msg);
goto err;
+ }
if (send_heartbeat_event(net, packet, coord))
{
errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR;
- mysql_mutex_unlock(log_lock);
+ thd->exit_cond(old_msg);
goto err;
}
}
@@ -863,7 +867,7 @@ impossible position";
DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
}
} while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
- mysql_mutex_unlock(log_lock);
+ thd->exit_cond(old_msg);
}
break;
Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20100903134539-d1slpa80q0tiwzu8.bundle