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

Fix/Implement own DNS resolver #2660

Closed
jhass opened this issue May 27, 2016 · 6 comments
Closed

Fix/Implement own DNS resolver #2660

jhass opened this issue May 27, 2016 · 6 comments

Comments

@jhass
Copy link
Member

jhass commented May 27, 2016

The current DNS resolver is broken for some usecases, buggy for others and some setups. We should replace it. See #2568 #2653 #2426.

A resolver written in Crystal is tricky since it would need to hook into OS specific APIs in order to resolve hosts from /etc/hosts, mDNS etc. Most POSIX API is blocking making it tricky to rely on in a language focused on asynchronous IO, see #2426 (comment)

This issue exists to collect issues in the current implementation and ways to mitigate them in possible replacements.

@lbguilherme
Copy link
Contributor

lbguilherme commented May 27, 2016

A possible implementation route would be using a library such as https://c-ares.haxx.se/ instead of creating it from scratch. This one seems to be portable across POSIX and Windows and can integrate with libevent. For example:

The ares_fds function retrieves the set of file descriptors which the calling application should select on for reading and writing for the processing of name service queries pending on the name service channel identified by channel.

From a very quick search, there are other libraries with similar functionality.

@asterite
Copy link
Member

asterite commented Jun 1, 2016

I propose to use C's getaddrinfo until we solve this well in a non-blocking fashion. I think it's preferable to have a blocking thing that works well than a non-blocking thing that's broken (and sometimes in a subtle way). Yes, sometimes a program will have hiccups of up to 5 seconds, but it will eventually work well.

We'd have to revert this commit and a maybe some others.

@zamith
Copy link
Contributor

zamith commented Jun 4, 2016

At this point with Crystal 0.17.4 I cannot use http/client because of this. Is it something related to my system, or is it broken?

@ysbaddaden
Copy link
Contributor

Closing: this should have been fixed by #2745.

@Sija
Copy link
Contributor

Sija commented May 15, 2018

@ysbaddaden But was it? If so, why #6099 then?

@rdp
Copy link
Contributor

rdp commented Nov 10, 2019

For followers, appears #6099 was caused by a shared v. static linking issue...FWIW...see also #4816

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

7 participants