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

net: Lookup fails if Internet connection is not available from the beginning #5833

Closed
mewmew opened this issue Jul 3, 2013 · 8 comments

Comments

Projects
None yet
4 participants
@mewmew
Copy link
Contributor

commented Jul 3, 2013

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Disable access to the Internet.
2. Run http://play.golang.org/p/WtWXjbVc7K
3. Enable access to the Internet.

What is the expected output?
A couple of "no such host" errors, and eventually the net.LookupHost should
complete successfully (and thus output the list of addresses) since it now has access to
the Internet.

2013/07/03 07:18:27 lookup google.com: no such host
2013/07/03 07:18:28 lookup google.com: no such host
2013/07/03 07:18:29 lookup google.com: no such host
[173.194.32.4 173.194.32.5 173.194.32.6 173.194.32.7 173.194.32.8 173.194.32.9
173.194.32.14 173.194.32.0 173.194.32.1 173.194.32.2 173.194.32.3
2a00:1450:400f:800::1006]


What do you see instead?
2013/07/03 07:18:27 lookup google.com: no such host
2013/07/03 07:18:28 lookup google.com: no such host
2013/07/03 07:18:29 lookup google.com: no such host
2013/07/03 07:18:30 lookup google.com: no such host
2013/07/03 07:18:31 lookup google.com: no such host
2013/07/03 07:18:32 lookup google.com: no such host
2013/07/03 07:18:33 lookup google.com: no such host
...

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Arch Linux

Which version are you using?  (run 'go version')
go version devel +64f7f4530ca8 Tue Jul 02 20:35:44 2013 -0700 linux/amd64
@davecheney

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2013

Comment 1:

Thanks for reporting this issue. Could you confirm if the problem exists _before_ rev
e255db359405.
@mewmew

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2013

Comment 2:

Hi Dave.
The same problem does exist prior to rev e255db359405. I reverted to rev
52d53d0e177e561b5fe7847b97f6e7fe0380745e, but the same behavior was still present.
Cheers /u
@minux

This comment has been minimized.

Copy link
Member

commented Jul 3, 2013

Comment 3:

should be a problem of libc resolver.
i can't reproduce the problem on Darwin, and both Darwin and Linux are using the same
getaddrinfo library function to resolve hostnames.
@gopherbot

This comment has been minimized.

Copy link

commented Jul 3, 2013

Comment 4 by capnm9:

Works here as expected on debian 7.1 and ubuntu 13.04, though on ubuntu is
the err message slightly wrong:
2013/07/03 17:44:39 [173.194.112.142 173.194.112.128 173.194.112.129 173.194.112.130
173.194.112.131 173.194.112.132 173.194.112.133 173.194.112.134 2a00:1450:4001:804::1003]
2013/07/03 17:44:40 [173.194.112.142 173.194.112.128 173.194.112.129 173.194.112.130
173.194.112.131 173.194.112.132 173.194.112.133 173.194.112.134 2a00:1450:4001:804::1003]
2013/07/03 17:44:46 lookup google.com: no such file or directory
2013/07/03 17:44:47 lookup google.com: no such file or directory
2013/07/03 17:44:48 lookup google.com: no such file or directory
2013/07/03 17:44:49 lookup google.com: no such file or directory
2013/07/03 17:44:50 lookup google.com: no such file or directory
2013/07/03 17:44:51 lookup google.com: no such file or directory
2013/07/03 17:44:52 lookup google.com: no such file or directory
2013/07/03 17:44:53 [173.194.112.142 173.194.112.128 173.194.112.129 173.194.112.130
173.194.112.131 173.194.112.132 173.194.112.133 173.194.112.134 2a00:1450:4001:804::1003]
2013/07/03 17:44:54 [173.194.112.142 173.194.112.128 173.194.112.129 173.194.112.130
173.194.112.131 173.194.112.132 173.194.112.133 173.194.112.134 2a00:1450:4001:804::1003]
@minux

This comment has been minimized.

Copy link
Member

commented Jul 3, 2013

Comment 5:

one way to diagnose this problem is to use ltrace(1):
wget http://play.golang.org/p/WtWXjbVc7K.go
go build WtWXjbVc7K.go
ltrace ./WtWXjbVc7K
the result will at least show the return value of getaddrinfo(3).
if it constantly returns -2 (EAI_NONAME), then it's not Go's problem,
and you should check your system's gai settings and DNS caches.

Status changed to WaitingForReply.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 3, 2013

Comment 6 by capnm9:

FYI #4 is an ubuntu bug:
getaddrinfo("google.com", NULL, 0xc21002e4e0, 0xc2100000d8)                             
          = -11
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1154599/comments/8
@mewmew

This comment has been minimized.

Copy link
Contributor Author

commented Jul 4, 2013

Comment 7:

Thank you minux for the information. The program did return -2 constantly. Killing the
DNS daemon and restarting it resolved the issue:
nscd -K
nscd
You can mark this as closed for the time being.
@minux

This comment has been minimized.

Copy link
Member

commented Jul 4, 2013

Comment 8:

no problem.
btw, i think it might be a bug of nscd. you probably should check your distribution's
bug tracker.

Status changed to Retracted.

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.