Skip to content
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

Add a simple retry to re-resolve the DNS host if the IP address has changed [ Feedback Required ] #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

berglh
Copy link

@berglh berglh commented Aug 25, 2020

Here is the testing output.

After the target IP address changes and the DNS record is updated, we retry the net.ResolveTCPAddr:

Connection #001 Closed (10109150 bytes sent, 9 bytes recieved)
Connection #002 Remote connection failed: dial tcp 172.18.0.31:6379: connect: no route to host, retry DNS resolution
Connection #002 Opened 0.0.0.0:6379 >>> 172.18.0.33:6379
Connection #002 >>> 20 bytes sent
...

After the remote host is stopped, we just return the failure but the go routine keeps running the same as previous failure:

Connection #002 Closed (10109150 bytes sent, 9 bytes recieved)
Connection #003 Remote connection failed: dial tcp 172.18.0.31:6379: connect: no route to host, retry DNS resolution
Connection #003 Remote connection failed: lookup redis-primary on 127.0.0.11:53: no such host

After the host returns again on the same IP:

Connection #002 Closed (10109150 bytes sent, 9 bytes recieved)
Connection #003 Remote connection failed: dial tcp 172.18.0.31:6379: connect: no route to host, retry DNS resolution
Connection #003 Remote connection failed: lookup redis-primary on 127.0.0.11:53: no such host
Connection #004 Remote connection failed: dial tcp 172.18.0.31:6379: connect: no route to host, retry DNS resolution
Connection #004 Opened 0.0.0.0:6379 >>> 172.18.0.33:6379
Connection #004 >>> 20 bytes sent
...

Problems with this PR

I believe because the Start function references a pointer to the proxy struct, when we set the new IP address after resolving the new name, any future session will be still using the old IP first. Any ideas on circumventing this would be appreciated.

@josegonzalez
Copy link

@jpillora any chance that this can get merged?

@josegonzalez
Copy link

Also, this would close #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants