Bug #81643 mysqlrouter should exit when fail to bind port
Submitted: 30 May 2016 12:10 Modified: 11 Aug 2017 19:22
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Router Severity:S2 (Serious)
Version:2.0.3 OS:CentOS (6.6)
Assigned to: CPU Architecture:Any

[30 May 2016 12:10] Tsubasa Tanaka
Description:
MySQL Router doesn't exit even it fails bind a port.

How to repeat:
Using port 3306 by another(not mysqlrouter) process.

# ncat -k -l 3306 &
[1] 185

Configuring mysqlrouter.ini to using 3306.

# cat /etc/mysqlrouter/mysqlrouter.ini
..
[routing:basic_failover]
# To be more transparent, use MySQL Server port 3306
bind_port = 3306
mode = read-write
destinations = 127.0.0.1

Start mysqlrouter.

# mysqlrouter &

mysqlrouter starts and runs, but..

# ps auxww | grep mysqlrouter
root       187  0.0  0.2 180556  2148 pts/0    Sl   21:00   0:00 mysqlrouter
root       199  0.0  0.0 103300   876 pts/0    S+   21:10   0:00 grep mysqlrouter

# grep ERROR /var/log/mysqlrouter/mysqlrouter.log
2016-05-30 21:00:49 ERROR   [7effbca1f700] routing:basic_failover: Bind Address can not be part of destinations

# netstat -ltpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      185/ncat
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      35/sshd
tcp        0      0 :::22                       :::*                        LISTEN      35/sshd

Suggested fix:
mysqlrouter should exit when it fail to bind port.
[31 May 2016 7:54] MySQL Verification Team
Hello Tanaka-San,

Thank you for the report.

Thanks,
Umesh
[11 Aug 2017 19:22] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Router 8.0.3 release, and here's the changelog entry:

Router would not exit after failing to bind to a port despite posting
"Bind Address can not be part of destinations" to the error log.

Thank you for the bug report.