Description:
MySQL Router doesn't recover if a backend connetion fails
How to repeat:
1. Start MySQL Router
2. Connect with mysqlsh to the router (expected: error, actual: error)
3. Start backend server
4. Connect with mysqlsh again (expected: ok, actual: error)
Logging:
2017-03-07 18:34:36 INFO [7f3963f0b700] keepalive started with interval 60
2017-03-07 18:34:36 INFO [7f3963f0b700] keepalive
2017-03-07 18:34:36 INFO [7f396370a700] [routing:test_1] started: listening on 127.0.0.1:7001; read-write
2017-03-07 18:34:42 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:34:42 DEBUG [7f3961f07700] Trying server 127.0.0.1:33060 (index 0)
2017-03-07 18:34:42 DEBUG [7f3961f07700] Socket error: 127.0.0.1:33060: Connection refused (111)
2017-03-07 18:34:42 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:34:56 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:34:56 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:34:57 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:34:57 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:34:58 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:34:58 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:34:59 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:34:59 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:35:36 INFO [7f3963f0b700] keepalive
2017-03-07 18:36:05 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:36:05 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:36:21 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:36:21 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:36:23 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:36:23 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:36:23 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:36:23 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:36:29 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:36:29 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
2017-03-07 18:36:36 INFO [7f3963f0b700] keepalive
2017-03-07 18:37:36 INFO [7f3963f0b700] keepalive
2017-03-07 18:38:36 INFO [7f3963f0b700] keepalive
2017-03-07 18:39:12 DEBUG [7f3962f09700] [routing:test_1] TCP connection from 4 accepted at 127.0.0.1:7001
2017-03-07 18:39:12 WARNING [7f3961f07700] [routing:test_1] Can't connect to remote MySQL server for client '127.0.0.1:7001'
Config:
[DEFAULT]
logging_folder =
[logger]
level = DEBUG
[routing:test_1]
bind_port = 7001
mode = read-write
protocol = x
destinations = 127.0.0.1:33060
[keepalive]
interval = 60
Suggested fix:
Ensure backend connections recover after a failure by default.