You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed while troubleshooting an issue with the farmerbot that RetryingClient fails to move on from an unreachable DNS server, in the case that multiple DNS servers are specified in resolve.conf. This is in direct contrast to a textbook net/http example program, where the unreachable DNS server is only tried once and the program quickly moves on to a reachable server to complete the request.
Here are the two programs to compare. First the generic example:
// example.gopackage main
import (
"fmt""io/ioutil""net/http"
)
funcmain() {
// URL of the webpage to fetchurl:="https://example.com"// Send an HTTP GET requestresponse, err:=http.Get(url)
iferr!=nil {
fmt.Printf("Error fetching %s: %v\n", url, err)
return
}
deferresponse.Body.Close() // Ensure the response body is closed// Read the response bodybody, err:=ioutil.ReadAll(response.Body)
iferr!=nil {
fmt.Printf("Error reading response body: %v\n", err)
return
}
// Print the response body as a stringfmt.Println(string(body))
}
I noticed while troubleshooting an issue with the farmerbot that
RetryingClient
fails to move on from an unreachable DNS server, in the case that multiple DNS servers are specified inresolve.conf
. This is in direct contrast to a textbooknet/http
example program, where the unreachable DNS server is only tried once and the program quickly moves on to a reachable server to complete the request.Here are the two programs to compare. First the generic example:
Now the example using the proxy client:
Here's a demo comparing the DNS behaviors of the two programs. We simulate an unreachable DNS server by adding a dummy address to
resolv.conf
:The proxy client will eventually give up. It never tries the working server further down the list.
The text was updated successfully, but these errors were encountered: