Project

General

Profile

Actions

Feature #15628

closed

init_inetsock_internal should fallback to IPv4 if IPv6 is unreachable

Added by sonalkr132 (Aditya Prakash) over 5 years ago. Updated 7 months ago.

Status:
Closed
Target version:
-
[ruby-core:91641]

Description

Hi,

This is not really bug but more of a missing feature. Let me layout steps to reproduce what I am trying to achieve:

  • Add local entries for example.com
$ echo "::1     example.com www.example.com
127.0.0.1 example.com www.example.com" | sudo tee  --append /etc/hosts
  • Add rule to DROP ipv6 packets: sudo ip6tables -P INPUT DROP
  • Start a server: ruby -rwebrick -e 'WEBrick::HTTPServer.new(Port: 8000).start'
  • Making request using Net:HTTP with timeout (Net::OpenTimeout) after after 60 seconds: ruby -rnet/http -e "Net::HTTP.get(URI('http://example.com:8000'))"

As far as I understand, init_inetsock_internal needs to fallback to ipv4 for Net::HTTP.get to work. IPv6 route being broke is expected and hence, RFC8305 recommends fallback to IPv4.
Support for IPv6 fallback is spotty across languages and http clients, for example, golang supports it but python doesn't, making request with curl works but wget hangs.


Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #17525: Implement Happy Eyeballs Version 2 (RFC8305) in Socket.tcpClosedGlass_saga (Masaki Matsushita)Actions
Related to Ruby master - Feature #20108: Introduction of Happy Eyeballs Version 2 (RFC8305) in Socket.tcpClosedActions

Updated by sonalkr132 (Aditya Prakash) over 5 years ago

Net:HTTP with timeout (Net::OpenTimeout) after after 60 seconds

I meant "Net:HTTP will timeout (Net::OpenTimeout) after 60 seconds".

Any suggestion on fixing this would very helpful . So far I have tried using Socket.tcp(addr.ip_address, serv).close to preemptively check if resolved addresses are reachable. It works but it is very inefficient.
Besides the brute steps explained above, in the wild, this only affects host which have an IPv6 address but their IPv6 route to our CDN is broken. Personal home networks which generally have only IPv4 connectivity seamlessly use the IPv4 address to start the connection (without the need for a fallback).

Updated by deivid (David Rodríguez) about 4 years ago

Hi!

Any feedback about this? We're considering implementing "Happy Eyeballs" in rubygems by monkeypatching TCPSocket.new, in order to fix longstanding issues with gem install timing out on ipv6-capable clients. But it would feel much better if this was built in.

Updated by Glass_saga (Masaki Matsushita) about 4 years ago

  • Status changed from Open to Assigned
  • Assignee set to Glass_saga (Masaki Matsushita)
Actions #5

Updated by Glass_saga (Masaki Matsushita) almost 4 years ago

  • Related to Feature #17525: Implement Happy Eyeballs Version 2 (RFC8305) in Socket.tcp added
Actions #6

Updated by hsbt (Hiroshi SHIBATA) 7 months ago

  • Related to Feature #20108: Introduction of Happy Eyeballs Version 2 (RFC8305) in Socket.tcp added

Updated by hsbt (Hiroshi SHIBATA) 7 months ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0