lostisland/faraday-net_http

Wrap Errno::EALREADY

Closed this issue · 2 comments

Basic Info

  • Faraday Version: 2.3.0
  • Ruby Version: 3.1.2

Issue description

Connecting to a dead kubernetes service raises a Errno::EALREADY

Steps to reproduce

Faraday.new('http://foo.bar.svc.cluster.local').get '/'
Faraday.new('http://truth-service-x.truth-service.svc.cluster.local').get '/ping'
/usr/lib/ruby/3.1.0/socket.rb:1214:in `__connect_nonblock': Failed to open TCP connection to truth-service-x.truth-service.svc.cluster.local:80 (Operation already in progress - connect(2) for 172.29.8.85:80) (Errno::EALREADY)
	from /usr/lib/ruby/3.1.0/socket.rb:1214:in `connect_nonblock'
	from /usr/lib/ruby/3.1.0/socket.rb:56:in `connect_internal'
	from /usr/lib/ruby/3.1.0/socket.rb:137:in `connect'
	from /usr/lib/ruby/3.1.0/socket.rb:642:in `block in tcp'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `each'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `foreach'
	from /usr/lib/ruby/3.1.0/socket.rb:632:in `tcp'
	from /usr/lib/ruby/3.1.0/net/http.rb:998:in `connect'
	from /usr/lib/ruby/3.1.0/net/http.rb:976:in `do_start'
	from /usr/lib/ruby/3.1.0/net/http.rb:965:in `start'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:136:in `request_via_get_method'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:127:in `request_with_wrapped_block'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:120:in `perform_request'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:65:in `block in call'
	from /usr/bundle/ruby/3.1.0/gems/faraday-2.3.0/lib/faraday/adapter.rb:45:in `connection'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:64:in `call'
	... 23 levels...
/usr/lib/ruby/3.1.0/socket.rb:1214:in `__connect_nonblock': Operation already in progress - connect(2) for 172.29.8.85:80 (Errno::EALREADY)
	from /usr/lib/ruby/3.1.0/socket.rb:1214:in `connect_nonblock'
	from /usr/lib/ruby/3.1.0/socket.rb:56:in `connect_internal'
	from /usr/lib/ruby/3.1.0/socket.rb:137:in `connect'
	from /usr/lib/ruby/3.1.0/socket.rb:642:in `block in tcp'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `each'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `foreach'
	from /usr/lib/ruby/3.1.0/socket.rb:632:in `tcp'
	from /usr/lib/ruby/3.1.0/net/http.rb:998:in `connect'
	from /usr/lib/ruby/3.1.0/net/http.rb:976:in `do_start'
	from /usr/lib/ruby/3.1.0/net/http.rb:965:in `start'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:136:in `request_via_get_method'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:127:in `request_with_wrapped_block'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:120:in `perform_request'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:65:in `block in call'
	from /usr/bundle/ruby/3.1.0/gems/faraday-2.3.0/lib/faraday/adapter.rb:45:in `connection'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:64:in `call'

@grosser we just run into the same issue. Any idea why this recently changed in k8s? We used to get a connection refused error before.

afaik this is ubuntu 20.04 changing it's network stack to systemd, we did not get this from a kubernetes upgrade