predixy
predixy copied to clipboard
Validate Addr, Exclude nodes with invalid ip address
Problem Statement
Recently we faced an issue with predixy during redis cluster scaling, where it was trying to connect to empty host.
Incidents
-
PHP Redis client threw error message "read error on connection".
-
On checking predixy logs we found
2019-11-12 08:05:03.498123 W Handler.cpp:396 h 4 c 127.0.0.1:47187 430 handle event 1 exception Socket.cpp:120 invalid addr :6379:Name or service not knownwhere addr is empty
- Predixy INFO command output
here one of the slaves are registered in the server pool even though it's host is invalid.
After replicating this issue on a test cluster, we found out that at some point "cluster nodes" is returning an invalid response where it doesn't have addr though the flag is valid (slave).
D ClusterServerPool.cpp:103 redis cluster update parse node 52a144f80835728846892506bbd7942ac49bf09c :6379@1122 slave -
Solution
- To handle this case this pull request adds address validation step to discard such invalid response from the redis.
Although the redis should respond according to the protocol, I think if the redis responds with an invalid format, predixy should do validations before inserting into the pool.