async: SocketError: getaddrinfo: nodename nor servname provided, or not known

Ruby version: 3.1.2 async: 2.1.0 async-http: 0.59.2 OS: macOS Monterey

Getting the following error and stack trace when making any HTTP calls.

The example below is when running this example from the async-http readme.

What’s interesting is that everything works if I downgrade the async gem to 1.30.3 🤔

SocketError: getaddrinfo: nodename nor servname provided, or not known
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:770:in `ip'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:770:in `sender'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:527:in `block in fetch_resource'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1125:in `block (3 levels) in resolv'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1123:in `each'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1123:in `block (2 levels) in resolv'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1122:in `each'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1122:in `block in resolv'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1120:in `each'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:1120:in `resolv'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:521:in `fetch_resource'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:507:in `each_resource'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:402:in `each_address'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:116:in `block in each_address'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:115:in `each'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:115:in `each_address'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:102:in `getaddresses'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/resolv.rb:51:in `getaddresses'
/backend/vendor/bundle/ruby/3.1.0/gems/async-2.1.0/lib/async/scheduler.rb:139:in `address_resolve'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo'
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/socket.rb:227:in `foreach'
/backend/vendor/bundle/ruby/3.1.0/gems/async-io-1.34.0/lib/async/io/host_endpoint.rb:57:in `connect'
/backend/vendor/bundle/ruby/3.1.0/gems/async-io-1.34.0/lib/async/io/ssl_endpoint.rb:92:in `connect'
/backend/vendor/bundle/ruby/3.1.0/gems/async-http-0.59.2/lib/async/http/endpoint.rb:201:in `connect'
/backend/vendor/bundle/ruby/3.1.0/gems/async-http-0.59.2/lib/async/http/client.rb:199:in `block in make_pool'
/backend/vendor/bundle/ruby/3.1.0/gems/async-pool-0.3.12/lib/async/pool/controller.rb:249:in `create_resource'
/backend/vendor/bundle/ruby/3.1.0/gems/async-pool-0.3.12/lib/async/pool/controller.rb:300:in `get_resource'
/backend/vendor/bundle/ruby/3.1.0/gems/async-pool-0.3.12/lib/async/pool/controller.rb:266:in `block in available_resource'
/backend/vendor/bundle/ruby/3.1.0/gems/async-2.1.0/lib/async/semaphore.rb:66:in `acquire'
/backend/vendor/bundle/ruby/3.1.0/gems/async-pool-0.3.12/lib/async/pool/controller.rb:265:in `available_resource'
/backend/vendor/bundle/ruby/3.1.0/gems/async-pool-0.3.12/lib/async/pool/controller.rb:231:in `wait_for_resource'
/backend/vendor/bundle/ruby/3.1.0/gems/async-pool-0.3.12/lib/async/pool/controller.rb:82:in `acquire'
/backend/vendor/bundle/ruby/3.1.0/gems/async-http-0.59.2/lib/async/http/client.rb:106:in `call'
/backend/vendor/bundle/ruby/3.1.0/gems/protocol-http-0.23.12/lib/protocol/http/middleware.rb:50:in `call'
/backend/vendor/bundle/ruby/3.1.0/gems/protocol-http-0.23.12/lib/protocol/http/accept_encoding.rb:50:in `call'
/backend/vendor/bundle/ruby/3.1.0/gems/async-http-0.59.2/lib/async/http/internet.rb:67:in `call'
/backend/vendor/bundle/ruby/3.1.0/gems/async-http-0.59.2/lib/async/http/internet.rb:80:in `block (2 levels) in <class:Internet>'
/backend/lib/story_library/client.rb:42:in `block (2 levels) in get_stories'
/backend/vendor/bundle/ruby/3.1.0/gems/async-2.1.0/lib/async/task.rb:107:in `block in run'
/backend/vendor/bundle/ruby/3.1.0/gems/async-2.1.0/lib/async/task.rb:243:in `block in schedule'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

That’s okay, it confirms what I found out in the linked issue, something is wrong with IPv6 addresses in resolv.rb - I can test this out and should be able to repro/fix.

Thanks for fixing 😄

Are you sure the hostname is correct? Can you tell me the request from client.rb:42?

I was testing with the URL provided in the async-http readme: https://httpbin.org/anything Same deal if I use the actual URL or https://google.com etc.

Also tried with these benchmarking scripts and faced the same error.

Are you using a local dev DNS server?

Nope