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

Use Ruby Resolv instead of LibC for hostname lookup #739

Merged
merged 2 commits into from Mar 21, 2021

Conversation

carlhoerberg
Copy link
Contributor

This way DNS resolver can be replaced with:

Resolv::DefaultResolver.replace_resolvers [Resolv::DNS.new(nameserver: '8.8.8.8')]

Related: #159, #184

This way DNS resolver can be replaced with:

```ruby
Resolv::DefaultResolver.replace_resolvers [Resolv::DNS.new(nameserver: ['8.8.8.8']]
```

Related: excon#159, excon#184
@carlhoerberg carlhoerberg changed the title Resolv Use Ruby Resolv instead of LibC for hostname lookup Mar 20, 2021
@carlhoerberg
Copy link
Contributor Author

Using this branch in production right now, polling a couple of thousand HTTPS APIs every minute or s for stats. Without it the DNS server would rate limit us and we couldn't swap it out as we had no access to modify /etc/resolve.conf.

Copy link
Contributor

@geemus geemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@geemus geemus merged commit bbb5bd7 into excon:master Mar 21, 2021
@rafbm
Copy link

rafbm commented May 6, 2021

Anyone updating to Excon v0.80.0+ for this functionality, beware of #747. Some versions of Resolv cause processes to hang in an infinite loop: https://bugs.ruby-lang.org/issues/17781.

@pboling
Copy link

pboling commented May 14, 2021

@pboling
Copy link

pboling commented May 14, 2021

My detailed fix for this issue:
sidekiq/sidekiq#2175 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants