Bug #68681 mysqlbinlog with -R --stop-never left connection after mysqlbinlog stopped
Submitted: 15 Mar 2013 3:02 Modified: 18 Mar 2013 5:03
Reporter: tsubasa tanaka (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.10 OS:Linux
Assigned to: CPU Architecture:Any
Tags: mysqlbinlog

[15 Mar 2013 3:02] tsubasa tanaka
Description:
see "How to repeat".

How to repeat:
$ mysqlbinlog --read-from-remote-master=BINLOG-DUMP-NON-GTIDS --host=127.0.0.1 --port=64056 --stop-never bin.001725

Stop by Ctrl+C

mysql> SHOW PROCESSLIST;

mysql56> show processlist;
+----+------+-----------------+------+-------------+------+-----------------------------------------------------------------------+------------------+
| Id | User | Host            | db   | Command     | Time | State                                                                 | Info             |
+----+------+-----------------+------+-------------+------+-----------------------------------------------------------------------+------------------+
| 22 | root | localhost       | NULL | Query       |    0 | init                                                                  | show processlist |
| 24 | root | localhost:60420 | NULL | Binlog Dump |    8 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL             |
+----+------+-----------------+------+-------------+------+-----------------------------------------------------------------------+------------------+
2 rows in set (0.00 sec)

backtrace of mysqlbinlog.

(Ctrl + C)
..
Program received signal SIGINT, Interrupt.
0x0000003d8220e94c in recv () from /lib64/libpthread.so.0
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64 libgcc-4.4.6-4.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64
(gdb) bt
#0  0x0000003d8220e94c in recv () from /lib64/libpthread.so.0
#1  0x0000000000441959 in inline_mysql_socket_recv (vio=0x9ed2b0, buf=0x9ed4a0 "&", size=16384)
    at /home/ttanaka/mysql-5.6.10/include/mysql/psi/mysql_socket.h:801
#2  vio_read (vio=0x9ed2b0, buf=0x9ed4a0 "&", size=16384) at /home/ttanaka/mysql-5.6.10/vio/viosocket.c:114
#3  0x00000000004419d2 in vio_read_buff (vio=0x9ed2b0, buf=0x9f14b0 "", size=4)
    at /home/ttanaka/mysql-5.6.10/vio/viosocket.c:157
#4  0x00000000004247f3 in net_read_raw_loop (net=0x9eab20, complen=0x7fffffffc908)
    at /home/ttanaka/mysql-5.6.10/sql/net_serv.cc:663
#5  net_read_packet_header (net=0x9eab20, complen=0x7fffffffc908) at /home/ttanaka/mysql-5.6.10/sql/net_serv.cc:751
#6  net_read_packet (net=0x9eab20, complen=0x7fffffffc908) at /home/ttanaka/mysql-5.6.10/sql/net_serv.cc:810
#7  0x0000000000424b0c in my_net_read (net=0x9eab20) at /home/ttanaka/mysql-5.6.10/sql/net_serv.cc:888
#8  0x0000000000430cfa in cli_safe_read (mysql=<value optimized out>) at /home/ttanaka/mysql-5.6.10/sql-common/client.c:610
#9  0x00000000004201f2 in dump_remote_log_entries (logname=<value optimized out>)
    at /home/ttanaka/mysql-5.6.10/client/mysqlbinlog.cc:2036
#10 dump_log_entries (logname=<value optimized out>) at /home/ttanaka/mysql-5.6.10/client/mysqlbinlog.cc:1769
#11 0x0000000000420dd3 in main (argc=0, argv=0x9c9630) at /home/ttanaka/mysql-5.6.10/client/mysqlbinlog.cc:2765

Suggested fix:
Add connection close function to mysqlbinlog when it receive SIGINT.
or
Add a way to stop mysqlbinlog with connection close.
[18 Mar 2013 5:03] tsubasa tanaka
This is my mistake.
mysqlbinlog and Slave's I/O thread doesn't handle connection state before.

After mysqlbinlog exits mysqld close the connection when mysqld tries to send a binary log entry some time.

I'm sorry.