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
host named "dns" causes DNS error #20972
Comments
CC @apolcyn |
This is easy to reproduce, and looks like a kind of bug in the way that we form the uri when creating a channel. Note that gRPC channels technically require a target string to be a full uri, with a "scheme", "authority", "path" component - e.g. "dns:///foo.com". However, if the "scheme" component is omitted, then we prepend the default "dns" scheme. https://github.com/grpc/grpc/blob/master/doc/naming.md for details. In the insecure channel creation code, the "maybe add default scheme" is basically done in this call:
Internally, that parses the uri and attempts to lookup a "resolver factory" registered for the parsed uri's scheme. If no factory exists, then we prepend the default scheme to the uri and try again, and now use this new prepended target as the server target for the channel. Otherwise, we leave the target as is. I.e. the difference between creating a channel with target:"dns" and target:"dns2" is this code path:
A fix might involve making the URI parser code stricter, and to fail when the target uri doesn't have scheme. @jossef it would be good to know how bad the impact is of this bug though - is inability to resolve targets of "dns" a blocker for you? I'm actually a little surprised by use of "dns" as a hostname. |
@apolcyn @yarelm The impact is of this bug - an hour of troubleshooting :). The inability to resolve targets named "dns" is annoying but for me, this is not a blocker. I've worked it around and named it Until this issue is fixed, suggesting to add a warning for the developer, stating that the hostname "dns" will not resolve due to this issue. as for the use of the "dns" as a hostname - one of my microservices is a DNS service. this is why. |
@jossef The right way to fix this is to just prepend all your endpoints with |
if this is the uri i use in a virtual machine "http://172.18.0.3:8501", why i still receive the same problem? I am the user that opened "tensorflow/serving#1535" |
I test use consul dns,but it failed connect
error message:
I use dig command , it can resolve web.service.consul |
I am facing a similar issue. I can use Python 3.x and Google Translate API just fine. But the following error occurs when running the script via CRON (in an otherwise tested setup).
Details are posted here: https://stackoverflow.com/questions/60811596/error-503-dns-resolution-failed-in-google-translate-api-but-only-when-executing |
This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 30 days. It will be closed automatically if no further update occurs in 7 day. Thank you for your contributions! |
Stack python3.7 grpcio==1.23.0
When connecting to a target hostname
dns
I'm always getting a DNS error, even though the DNS resolution is valid.Fails with
to reproduce, add this to your
/etc/hosts
file and run any python client-server simple example but connect viadns
hostnameThe text was updated successfully, but these errors were encountered: