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

Creating TCPSocket fails with getaddrinfo: Non-recoverable failure in name resolution (Socket::Error) #2653

Closed
charles-l opened this issue May 26, 2016 · 7 comments

Comments

@charles-l
Copy link

May be related to #2568?

Using the same code in that issue:

require "socket"
p TCPSocket.new("google.com", 80)
p TCPSocket.new("google.com", 80)

The resulting output is (for Crystal - it works with ruby code, so It's probably something related to libevent):

getaddrinfo: Non-recoverable failure in name resolution (Socket::Error)
[4316279] *CallStack::unwind:Array(Pointer(Void)) +87
[4316170] *CallStack#initialize<CallStack>:Array(Pointer(Void)) +10
[4316122] *CallStack::new:CallStack +42
[4368809] *Socket::Error +41
[4368745] *Socket::Error +105
[4363191] *TCPSocket#initialize<TCPSocket, String, Int32, Nil, Nil>:Nil +1655
[4361512] *TCPSocket::new<String, Int32, Nil, Nil>:TCPSocket +184
[4361323] *TCPSocket::new<String, Int32>:TCPSocket +27
[4293247] ???
[4301177] main +41
[140049360811841] __libc_start_main +241
[4291273] _start +41
[0] ???

I'm on ArchLinux, running Crystal version 0.17.3, and libevent version 2.0.22-2.

@asterite
Copy link
Member

We should maybe revert the commit that introduces this "feature" (anti-feature, I'd say, because it's broken). Problem is, dns_timeout would be ignored for now, and of course things will be a bit slower. I'll check with @waj when he comes back, I prefer to have something that works but is slower than something fast but broken. Of course the best thing to do is to fix this (don't know how, maybe not using libevent), but that will take more time.

@ysbaddaden
Copy link
Contributor

If we don't use libevent dns, then we're up to blocking Crystal altogether whenever we make a request... not just the current fiber, but everything, which can take from some hundred milliseconds to 5 seconds if unlucky :(

I looked around and there aren't any correct solution. Even getaddrinfo_a, (only available by glibc) uses signals instead of a couple of functions (start, poll).

@asterite
Copy link
Member

I guess then we'd need to do what @waj said here

@charles-l
Copy link
Author

So, is this something that's only broken on Linux or is it an issue elsewhere as well? I'll have to take a closer look at the IPSocket code, but I'm not sure what's causing this, since the example libnotify code for a DNS lookup works in C.

@jhass
Copy link
Member

jhass commented May 27, 2016

Should we close all these tickets and create a more general meta ticket about implementing a proper DNS/mDNS resolver?

@asterite
Copy link
Member

@jhass Please! And thank you for cleaning up some issues :-)

@jhass
Copy link
Member

jhass commented May 27, 2016

Closing in favor of #2660

@jhass jhass closed this as completed May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants