0

Following snippet failing for ruby, removing of this snippet didn't show any error. I see closed issue https://bugs.ruby-lang.org/issues/15067 , are they same. Any input on this snippet will be very useful.

platform_is_not :windows do
        describe 'using NI_NUMERICHOST as the flag' do
          it 'returns an Array containing the numeric hostname and service name' do
            Socket.getnameinfo(@addr, Socket::NI_NUMERICHOST).should == [ip_address, 'ftp']
          end
        end
      end

with error

Socket.getnameinfo using IPv4 using a 3 element Array as the first argument using NI_NUMERICHOST as the flag returns an Array containing the numeric hostname and service name ERROR
SocketError: sockaddr resolved to multiple nodename
/home/travis/build/alpha/ruby/spec/ruby/library/socket/socket/getnameinfo_spec.rb:111:in `getnameinfo'
/home/travis/build/alpha/ruby/spec/ruby/library/socket/socket/getnameinfo_spec.rb:111:in `block (6 levels) in <top (required)>'
/home/travis/build/alpha/ruby/spec/ruby/library/socket/socket/getnameinfo_spec.rb:65:in `<top (required)>'
R_SS
  • 317
  • 5
  • 21
  • 1
    What is the content of the "3 element Array"? (replacing the IP addresses or hostnames if needed) – Fravadona Apr 02 '21 at 13:17
  • ["AF_INET", 21, "localhost"] – R_SS Apr 04 '21 at 05:30
  • @Addr = ["AF_INET", 21, "localhost"] , Socket::NI_NUMERICHOST=1 , ip_address=127.0.0.1 – R_SS Apr 04 '21 at 05:54
  • What's the result of the following code when you run it that host (for ex. with `irb`)? `require 'socket'; Socket.getnameinfo(["AF_INET",21,"localhost"],Socket::NI_NUMERICHOST)` – Fravadona Apr 04 '21 at 11:09
  • Switch to inspect mode. require 'socket'; Socket.getnameinfo(["AF_INET",21,"localhost"],Socket::NI_NUMERICHOST) Traceback (most recent call last): 5: from /home/travis/.rvm/rubies/ruby-2.6.5/bin/irb:23:in `
    ' 4: from /home/travis/.rvm/rubies/ruby-2.6.5/bin/irb:23:in `load' 3: from /home/travis/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `' 2: from (irb):1 1: from (irb):1:in `getnameinfo' SocketError (sockaddr resolved to multiple nodename)
    – R_SS Apr 05 '21 at 15:50
  • Do you have DNS aliases for that IP? DNS load balancing for that hostname? – Fravadona Apr 05 '21 at 19:00
  • cat /etc/hosts ## Managed by Chef on packer-5fe9f627-e9d8-8da5-7235-a54548d5f923.c.eco-emissary-99515.internal :heart_eyes_cat: ## cookbook:: travis_build_environment ## file:: templates/default/etc/cloud/templates/hosts.tmpl.erb 127.0.1.1 localhost localhost ip4-loopback 127.0.0.1 localhost nettuno travis vagrant travis-job-381572c2-8a24-4697-9727-73c63c8d8d81 – R_SS Apr 06 '21 at 04:52
  • No dns loadbalancing present. – R_SS Apr 06 '21 at 04:52
  • Why do you have `127.0.1.1 localhost` and `127.0.0.1 localhost` in your `/etc/hosts` ?? That is the cause of your problem – Fravadona Apr 06 '21 at 07:36
  • I started on new system, its good now. – R_SS Apr 08 '21 at 10:42

0 Answers0