Bug #651 If MASTER_POS_WAIT() is waiting, it does not stop if someone does STOP SLAVE
Submitted: 13 Jun 2003 8:03 Modified: 14 Jun 2003 7:44
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:4.0 OS:Any (all)
Assigned to: Guilhem Bichot

[13 Jun 2003 8:03] Guilhem Bichot
Currently, MASTER_POS_WAIT() is a loop like this:
while (!slave_SQL_thread_killed)
  if position_we_wait_for<=current_position {we are done}
  /* else wait for some new data in the relay log */
So if the SQL thread has read all relay logs, and the position is still not reached, MASTER_POS_WAIT() is waiting in pthread_cond_wait(),
and someone does STOP SLAVE, pthread_cond_wait() will not terminate
(it is never signaled), and so will never do the test in while(),
so will remain stuck (unless it was called with a timeout).

How to repeat:
Set up replication.
When it works and the master and slave are idle,
SELECT master_pos_wait('the_current_master_binlog', a_too_big_position);
and in another connection do STOP SLAVE;

Suggested fix:
I'll fix that.
[14 Jun 2003 7:44] Guilhem Bichot
Fixed in 4.0 in changeset 1.1519.
[26 Feb 2007 10:34] Sveta Smirnova
This bug seems introduced again in 4.1. See also Bug #26622