Bug #31024 STOP SLAVE does not stop attempted connect()s

Submitted: 14 Sep 2007 8:30 Modified: 26 Mar 2008 8:31
Reporter: Domas Mituzas Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0-bk, 5.1-bk OS:Any
Assigned to: Sven Sandberg CPU Architecture:Any
Tags: Delay, start slave, stop slave, timeout

[14 Sep 2007 8:30] Domas Mituzas
Description:
If I/O thread is attempting to connect, SLAVE STOP will wait for that attempt to finish instead of interrupting it immediately. Combined with Bug#30932 this is serious trouble, as connects wait for minutes and it is impossible to control that. 

How to repeat:
IP addresses are of hosts that are down

Server version: 5.1.23-beta-debug-log Source distribution

mysql> change master to master_host='192.168.1.111';
Query OK, 0 rows affected (0.06 sec)
mysql> slave start;
Query OK, 0 rows affected (0.00 sec)
mysql> slave stop;
Query OK, 0 rows affected (1 min 14.03 sec)

===

Server version: 5.0.50-debug-log Source distribution

mysql> change master to master_host='192.168.1.112';
Query OK, 0 rows affected (0.79 sec)
mysql> slave start;
Query OK, 0 rows affected (0.00 sec)
mysql> slave stop;
Query OK, 0 rows affected (1 min 14.00 sec)

Suggested fix:
stop the slave immediately, don't wait for timeout.
[27 Feb 2008 12:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43044

ChangeSet@1.2576, 2008-02-27 16:40:28+04:00, ramil@mysql.com +1 -0
  Fix for bug #31024: STOP SLAVE does not stop attempted connect()s
  
  Problem: if the IO slave thread is attempting to connect,
  STOP SLAVE waits for the attempt to finish. 
  It might take too long.
  
  Fix: don't wait, stop the slave immediately.
[11 Mar 2008 8:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43743

ChangeSet@1.2589, 2008-03-11 10:03:23+01:00, sven@riska.(none) +2 -0
  BUG#31024: STOP SLAVE does not stop attempted connect()s
  Problem: if the IO slave thread is attempting to connect,
  STOP SLAVE waits for the attempt to finish. 
  It may take a long time.
  Fix: don't wait, stop the slave immediately.
[11 Mar 2008 12:57] Sven Sandberg
Committed a patch at https://intranet.mysql.com/secure/paste/displaypaste.php?codeid=3573
I have no idea why it doesn't show up automatically.
[11 Mar 2008 23:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43751

ChangeSet@1.2589, 2008-03-11 12:38:52+01:00, sven@riska.(none) +2 -0
  BUG#31024: STOP SLAVE does not stop attempted connect()s
  Problem: if the IO slave thread is attempting to connect,
  STOP SLAVE waits for the attempt to finish. 
  It may take a long time.
  Fix: don't wait, stop the slave immediately.
[11 Mar 2008 23:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43753

ChangeSet@1.2589, 2008-03-11 13:01:37+01:00, sven@riska.(none) +2 -0
  BUG#31024: STOP SLAVE does not stop attempted connect()s
  Problem: if the IO slave thread is attempting to connect,
  STOP SLAVE waits for the attempt to finish. 
  It may take a long time.
  Fix: don't wait, stop the slave immediately.
[11 Mar 2008 23:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43757

ChangeSet@1.2589, 2008-03-11 13:01:37+01:00, sven@riska.(none) +2 -0
   BUG#31024: STOP SLAVE does not stop attempted connect()s
   Problem: if the IO slave thread is attempting to connect,
   STOP SLAVE waits for the attempt to finish.
   It may take a long time.
   Fix: don't wait, stop the slave immediately.
[11 Mar 2008 23:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43763

ChangeSet@1.2597, 2008-03-11 14:42:54+01:00, sven@riska.(none) +2 -0
  BUG#31024: STOP SLAVE does not stop attempted connect()s
  Problem: if the IO slave thread is attempting to connect,
  STOP SLAVE waits for the attempt to finish. 
  It may take a long time.
  Fix: don't wait, stop the slave immediately.
[17 Mar 2008 3:53] Sven Sandberg
patch pushed to 5.0-rpl
[25 Mar 2008 11:22] Bugs System
Pushed into 5.0.60
[25 Mar 2008 11:23] Bugs System
Pushed into 5.1.24-rc
[26 Mar 2008 8:31] Jon Stephens
Documented bugfix in the 5.0.60 and 5.1.24 changelogs as follows:

        STOP SLAVE did not stop connection attempts properly.
        If the IO slave thread was attempting to connect, STOP
        SLAVE waited for the attempt to finish, sometimes for a long
        period of time, rather than stopping
        the slave immediately.
[26 Mar 2008 19:01] Bugs System
Pushed into 6.0.5-alpha
[30 Mar 2008 19:49] Jon Stephens
Also documented for 5.1.23-ndb-6.3.11 and 6.0.5.
[2 Mar 2009 22:40] Jasmin Letendre
It seems this bug is still there in 5.1.30 (mysqld  Ver 5.1.30-community-log for Win32 on ia32 (MySQL Community Server (GPL)).

I have a basic replication setup with one master and one slave, both running on the same windows host, with different port. Every time I try to stop the slave while the master is down, it takes a 1 minute timeout before STOP SLAVE returns.

I confirmed using show processlist that one thread is stuck in state 'Killing slave' while the slave thread is in state 'Reconnecting after a failed master event read'. Here is the complete output.

mysql> show processlist;
+----+-------------+----------------+-------+---------+------+-----------------------------------------------------------------------+------------------+
| Id | User        | Host           | db    | Command | Time | State                                                                 | Info             |
+----+-------------+----------------+-------+---------+------+-----------------------------------------------------------------------+------------------+
|  3 | root        | localhost:4337 | mysql | Query   |   16 | Killing slave                                                         | stop slave       |
|  4 | root        | localhost:4338 | mysql | Sleep   |    2 |                                                                       | NULL             |
|  7 | root        | localhost:4345 | NULL  | Sleep   | 1188 |                                                                       | NULL             |
| 17 | system user |                | NULL  | Connect |  110 | Reconnecting after a failed master event read                         | NULL             |
| 18 | system user |                | NULL  | Connect |  109 | Has read all relay log; waiting for the slave I/O thread to update it | NULL             |
| 19 | root        | localhost:4598 | NULL  | Query   |    0 | NULL                                                                  | show processlist |
+----+-------------+----------------+-------+---------+------+-----------------------------------------------------------------------+------------------+

Step to reproduce:
-make sure the master is down
-(on the slave)
   mysql> start slave;
   Query OK, 0 rows affected (0.00 sec)

   mysql> stop slave;
   Query OK, 0 rows affected (57.78 sec)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.075 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.