-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sentinel_tunnel stops working after several random host failures #7
Comments
There's a clear bug in the
for db_name := range c.get_master_address_by_name {
addr, err, is_client_closed := c.getMasterAddrByNameFromSentinel(db_name)
if err != nil {
if !is_client_closed {
c.get_master_address_by_name_reply <- ...
}
if !c.reconnectToSentinel() {
c.get_master_address_by_name_reply <- ...
}
continue
}
c.get_master_address_by_name_reply <-...
} No reply is sent in the This will block the I wouldn't use this in production, and definitely not with multiple databases configured, at the risk of applications connecting to / writing to the wrong database. |
The
func (c *Sentinel_connection) GetAddressByDbName(name string) (string, error) {
c.get_master_address_by_name <- name
reply := <-c.get_master_address_by_name_reply
return reply.reply, reply.err
} The only mitigating aspect here might be the use of unbuffered/blocking channels, which mean that the second A better way to implement this kind of request-reply pattern is to have the client create and send a new reply chan, and have the handling goroutine close that chan. |
infrastructure:
redis-01
redis-sentinel-01
redis-02
redis-sentinel-02
redis-03
redis-sentinel-03
sentinel-tunnel
procedure:
sentinel-tunnel:
changed to another host has become master
sentinel-tunnel:
shows all nodes up and running
sentinel-tunnel:
changed to third host has become master
sentinel-tunnel:
shows all nodes up and running
sentinel-tunnel:
doesn't reply anything and restart of sentinel_tunnel is needed, after works normal
Randomly sentinel_tunnel stops answering after 6th or 7th try of turning off hosts with redis.
logs are:
err: failed read line from client
dial tcp 10.1.10.160:26379: connect: connection refused
and hangs forever
The text was updated successfully, but these errors were encountered: