Commit e297990d authored by Alfranio Correia's avatar Alfranio Correia

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.
parent 75fd19ad
......@@ -5284,9 +5284,8 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
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,
thd->enter_cond(&update_cond, &LOCK_log,
"Master has sent all binlog to slave; "
"waiting for binlog to be updated");
if (!timeout)
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment