Validate Addr, Exclude nodes with invalid ip address #95
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 known
where addr is empty
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
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.