mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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.
This commit is contained in:
@ -5284,11 +5284,10 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
|
|||||||
const struct timespec *timeout)
|
const struct timespec *timeout)
|
||||||
{
|
{
|
||||||
int ret= 0;
|
int ret= 0;
|
||||||
const char* old_msg = thd->proc_info;
|
|
||||||
DBUG_ENTER("wait_for_update_bin_log");
|
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; "
|
"Master has sent all binlog to slave; "
|
||||||
"waiting for binlog to be updated");
|
"waiting for binlog to be updated");
|
||||||
if (!timeout)
|
if (!timeout)
|
||||||
mysql_cond_wait(&update_cond, &LOCK_log);
|
mysql_cond_wait(&update_cond, &LOCK_log);
|
||||||
else
|
else
|
||||||
|
@ -826,6 +826,7 @@ impossible position";
|
|||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
ulong hb_info_counter= 0;
|
ulong hb_info_counter= 0;
|
||||||
#endif
|
#endif
|
||||||
|
const char* old_msg= thd->proc_info;
|
||||||
signal_cnt= mysql_bin_log.signal_cnt;
|
signal_cnt= mysql_bin_log.signal_cnt;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -849,12 +850,15 @@ impossible position";
|
|||||||
#endif
|
#endif
|
||||||
/* reset transmit packet for the heartbeat event */
|
/* reset transmit packet for the heartbeat event */
|
||||||
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
|
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
|
||||||
|
{
|
||||||
|
thd->exit_cond(old_msg);
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
if (send_heartbeat_event(net, packet, coord))
|
if (send_heartbeat_event(net, packet, coord))
|
||||||
{
|
{
|
||||||
errmsg = "Failed on my_net_write()";
|
errmsg = "Failed on my_net_write()";
|
||||||
my_errno= ER_UNKNOWN_ERROR;
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
mysql_mutex_unlock(log_lock);
|
thd->exit_cond(old_msg);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -863,7 +867,7 @@ impossible position";
|
|||||||
DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
|
DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
|
||||||
}
|
}
|
||||||
} while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
|
} while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
|
||||||
mysql_mutex_unlock(log_lock);
|
thd->exit_cond(old_msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user