gem install error on rbx-2.2.5 #2929

Open
mpapis opened this Issue Feb 9, 2014 · 22 comments

Comments

Projects
None yet
2 participants
Contributor

mpapis commented Feb 9, 2014

$ruby -wdS gem install haml

Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- rubygems/defaults/operating_system
Exception: `NoMethodError' /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/config_file.rb:63 - undefined method `sysconfdir' on Etc (Module)
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- Win32API
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- Win32API
Exception: `NameError' /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/config_file.rb:325 - Missing or uninitialized constant: Gem::ConfigFile::Psych
Exception: `Gem::LoadError' /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/dependency.rb:309 - Could not find 'psych' (>= 1.2.1, ~> 1.2) among 103 total gem(s)
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- psych
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- psych
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- psych
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- psych
Exception: `NameError' kernel/bootstrap/array.rb:66 - method `yaml_as' not defined in Module
Exception: `NameError' kernel/common/module.rb:347 - undefined method `to_yaml_properties' for Object
Exception: `NameError' /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/syck_hack.rb:20 - Missing or uninitialized constant: Syck::Syck
Exception: `NameError' kernel/bootstrap/array.rb:66 - method `to_s' not defined in Syck::DefaultKey
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- etc.so
Exception: `LoadError' kernel/common/code_loader.rb:431 - no such file to load -- etc.so
Exception: `NoMethodError' kernel/common/type.rb:24 - undefined method `to_str' on spec:Symbol.
Exception: `TypeError' kernel/common/type.rb:19 - Coercion error: :spec.to_str => String failed
Exception: `NoMethodError' kernel/common/type.rb:24 - undefined method `to_str' on path:Symbol.
Exception: `TypeError' kernel/common/type.rb:19 - Coercion error: :path.to_str => String failed
Exception: `NoMethodError' kernel/common/type.rb:24 - undefined method `to_str' on value:Symbol.
Exception: `TypeError' kernel/common/type.rb:19 - Coercion error: :value.to_str => String failed
Exception: `NoMethodError' kernel/common/type.rb:24 - undefined method `to_str' on needed:Symbol.
Exception: `TypeError' kernel/common/type.rb:19 - Coercion error: :needed.to_str => String failed
Exception: `Resolv::ResolvTimeout' /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:521 - Resolv::ResolvTimeout
Exception: `Errno::EINVAL' /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1321 - Invalid argument - connect(2)
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - connect(2)
        kernel/common/errno.rb:17:in `handle'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1321:in `connect'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1328:in `send'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:768:in `send'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:662:in `request'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:521:in `each_resource'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1055:in `resolv'
        kernel/bootstrap/array.rb:66:in `each'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1053:in `resolv'
        kernel/bootstrap/array.rb:66:in `each'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1052:in `resolv'
        kernel/bootstrap/array.rb:66:in `each'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1050:in `resolv'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:513:in `each_resource'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:490:in `getresource'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/remote_fetcher.rb:88:in `api_endpoint'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/source.rb:42:in `api_uri'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/source.rb:170:in `load_specs'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/spec_fetcher.rb:266:in `tuples_for'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/spec_fetcher.rb:226:in `available_specs'
        kernel/bootstrap/array.rb:66:in `each'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/source_list.rb:97:in `each_source'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/spec_fetcher.rb:222:in `available_specs'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/spec_fetcher.rb:102:in `search_for_dependency'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/dependency_installer.rb:216:in `find_gems_with_sources'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/dependency_installer.rb:292:in `find_spec_by_name_and_version'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/dependency_installer.rb:166:in `available_set_for'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/dependency_installer.rb:418:in `resolve_dependencies'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/dependency_installer.rb:371:in `install'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/commands/install_command.rb:219:in `install_gem'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/commands/install_command.rb:263:in `install_gems'
        kernel/bootstrap/array.rb:66:in `each'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/commands/install_command.rb:259:in `install_gems'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/commands/install_command.rb:171:in `execute'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/command.rb:305:in `invoke_with_build_args'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/command_manager.rb:167:in `process_args'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/command_manager.rb:137:in `run'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/gem_runner.rb:54:in `run'
        /home/mpapis/.rvm/rubies/rbx-2.2.5/library/bin/gem.rb:21:in `__script__'
        kernel/delta/code_loader.rb:66:in `load_script'
        kernel/delta/code_loader.rb:152:in `load_script'
        kernel/loader.rb:649:in `script'
        kernel/loader.rb:831:in `main'
Exception: `Gem::SystemExitException' /home/mpapis/.rvm/rubies/rbx-2.2.5/site/rubygems/user_interaction.rb:158 - Exiting RubyGems with exit_code 1
Exception: `SystemExit' kernel/common/kernel.rb:265 - SystemExit
Owner

YorickPeterse commented Feb 10, 2014

Interesting, running this locally seems to work as intended. Does this issue occur consistently?

Contributor

mpapis commented Feb 10, 2014

it also happens for older versions of rubinius (like 2.2.3) but not for other rubies, how would I start debugging it?

Owner

YorickPeterse commented Feb 10, 2014

It could be that one of the configured RubyGems sources doesn't work, although I doubt that. This could be verified by running gem install --verbose --source https://rubygems.org haml.

Also, what is the output of gem env?

Looking at the stack trace it appears that rubysl-socket is having issues resolving the hostname, but it's hard to tell what would cause that. DNS errors and the likes would mean the issue would also occur on other Rubies.

Contributor

mpapis commented Feb 10, 2014

I get exactly the same result with:

$ gem install haml --verbose --source https://rubygems.org 
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - connect(2)

as for sources - gem env:

...
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
...
Owner

YorickPeterse commented Feb 10, 2014

Could you save the following somewhere (e.g. /tmp/debug.rb):

require 'socket'

class TCPSocket < IPSocket
  alias_method :_initialize, :initialize

  def initialize(*args)
    STDERR.puts("TCPSocket#initialize(#{args.map(&:inspect).join(', ')})")

    _initialize(*args)
  end
end

class UDPSocket < IPSocket
  alias_method :_connect, :connect

  def connect(*args)
    STDERR.puts("UDPSocket#connect(#{args.map(&:inspect).join(', ')})")

    return _connect(*args)
  end
end

Then run:

ruby -r /tmp/debug.rb -S gem install haml

And paste the output.

Owner

YorickPeterse commented Feb 10, 2014

For me that gives back the following:

UDPSocket#connect("8.8.8.8", 53)
TCPSocket#initialize("api.rubygems.org", 443, nil, nil)
TCPSocket#initialize("s3.amazonaws.com", 443, nil, nil)
TCPSocket#initialize("api.rubygems.org", 443, nil, nil)
TCPSocket#initialize("bundler.rubygems.org", 443, nil, nil)
TCPSocket#initialize("api.rubygems.org", 443, nil, nil)
TCPSocket#initialize("bundler.rubygems.org", 443, nil, nil)
TCPSocket#initialize("api.rubygems.org", 443, nil, nil)
TCPSocket#initialize("bundler.rubygems.org", 443, nil, nil)

HEADS UP! Haml 4.0 has many improvements, but also has changes that may break
your application:

* Support for Ruby 1.8.6 dropped
* Support for Rails 2 dropped
* Sass filter now always outputs <style> tags
* Data attributes are now hyphenated, not underscored
* html2haml utility moved to the html2haml gem
* Textile and Maruku filters moved to the haml-contrib gem

For more info see:

http://rubydoc.info/github/haml/haml/file/CHANGELOG.md

Successfully installed haml-4.0.5
1 gem installed
Contributor

mpapis commented Feb 12, 2014

I'm getting:

ruby -r ./debug-socket.rb -S gem install haml
UDPSocket#connect("127.0.0.1", 53)
UDPSocket#connect("192.168.1.254", 53)
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - connect(2)

and the long version: https://gist.github.com/mpapis/12c2b503a8c7895e95a8

Contributor

mpapis commented Feb 12, 2014

I was able to reproduce it by putting non-existing server in /etc/resolv.conf:

nameserver 192.168.123.123
Contributor

mpapis commented Feb 12, 2014

this problem does not happen with MRI or JRuby.

Owner

YorickPeterse commented Feb 12, 2014

This leads me to suspect it indeed is related to #2661.

Contributor

mpapis commented Feb 12, 2014

looks similar but there is no connectto, instead in man 3p connect I found:

APPLICATION USAGE
If connect() fails, the state of the socket is unspecified. Conforming applications should close the file descriptor and create a new socket before attempting to reconnect.

although I'm not sure it is related, but now as I found a way to reproduce you can experiment with it yourself

Contributor

mpapis commented Feb 12, 2014

btw. there was similar problem for IPV6 recently for MRI https://bugs.ruby-lang.org/issues/9477 and the command:

ruby -rresolv -e 'puts Resolv::DNS.new.getresource("_rubygems._tcp.rubygems.org", Resolv::DNS::Resource::IN::SRV).target'

also produces Invalid argument - connect(2) (Errno::EINVAL) for me.

Owner

YorickPeterse commented Feb 24, 2014

The particular fix for MRI can be found here: https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/44880/diff/lib/resolv.rb.

We should be able to import this into rubysl-resolv. Having a spec for this would be nice but I'm not sure how you'd spec this since it depends on the system configuration.

@YorickPeterse YorickPeterse added a commit to rubysl/rubysl-resolv that referenced this issue Feb 24, 2014

@YorickPeterse YorickPeterse Imported MRI revision 45144.
Resolv.rb has been updated according to MRI SVN revision 45144
(http://git.io/W3pM9Q on GitHub). This to address various issues related to
IPv6 as discussed here:

* https://bugs.ruby-lang.org/issues/9477
* rubinius/rubinius#2929
3f54b50

YorickPeterse self-assigned this Feb 24, 2014

Owner

YorickPeterse commented Feb 24, 2014

This should be fixed in 2.1.0 of rubysl-resolv. Can you run the following (under Rbx) and report the results?:

gem install rubysl-resolv -v 2.1.0
ruby -rresolv -e 'puts Resolv::DNS.new.getresource("_rubygems._tcp.rubygems.org", Resolv::DNS::Resource::IN::SRV).target'
Contributor

mpapis commented Feb 27, 2014

I have downloaded the gem ans installed with --local (as it was failing otherwise) but it does not solve the problem:

An exception occurred evaluating command line code:

    Invalid argument - connect(2) (Errno::EINVAL)

Backtrace:

                                                            Errno.handle at kernel/common/errno.rb:17
                                                       UDPSocket#connect at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1321
                                                          UDPSocket#send at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1328
                     Resolv::DNS::Requester::UnconnectedUDP::Sender#send at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:768
  Resolv::DNS::Requester(Resolv::DNS::Requester::UnconnectedUDP)#request at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:662
                                        { } in Resolv::DNS#each_resource at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:521
                                       { } in Resolv::DNS::Config#resolv at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1055
                                                              Array#each at kernel/bootstrap/array.rb:66
                                       { } in Resolv::DNS::Config#resolv at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1053
                                                              Array#each at kernel/bootstrap/array.rb:66
                                       { } in Resolv::DNS::Config#resolv at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1052
                                                              Array#each at kernel/bootstrap/array.rb:66
                                              Resolv::DNS::Config#resolv at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:1050
                                               Resolv::DNS#each_resource at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:513
                                                 Resolv::DNS#getresource at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.0.0/lib/rubysl/resolv/resolv.rb:490
                                                { } in Object#__script__ at -e:1
                             Rubinius::BlockEnvironment#call_on_instance at kernel/common/block_environment.rb:53
                                           Kernel(Rubinius::Loader)#eval at kernel/common/eval.rb:176
                                                  Rubinius::Loader#evals at kernel/loader.rb:616
                                                   Rubinius::Loader#main at kernel/loader.rb:830
Contributor

mpapis commented Feb 27, 2014

and the gem is installed and available in GEM_PATH:

> echo $GEM_PATH
/home/mpapis/.rvm/gems/rbx-2.2.5:/home/mpapis/.rvm/gems/rbx-2.2.5@global
> ls /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0
Gemfile  lib  LICENSE  Rakefile  README.md  rubysl-resolv.gemspec  spec

maybe the problem is in loading gems by rubinius

and it does not help even if I install the gem specifying installation path:

> gem install --local rubysl-resolv-2.1.0.gem -i /home/mpapis/.rvm/rubies/rbx-2.2.5/gems
> ls /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-resolv-2.1.0/
Gemfile  lib  LICENSE  Rakefile  README.md  rubysl-resolv.gemspec  spec
Owner

YorickPeterse commented Feb 27, 2014

What happens if you run the following?

ruby -e 'gem "rubysl-resolv"; require "resolv"; puts Resolv::DNS.new.getresource("_rubygems._tcp.rubygems.org", Resolv::DNS::Resource::IN::SRV).target'

It could indeed be that Rbx prioritizes the bootstrapped load path over $GEM_PATH.

Contributor

mpapis commented Feb 28, 2014

ruby -e 'gem "rubysl-resolv"; require "resolv"; puts Resolv::DNS.new.getresource("_rubygems._tcp.rubygems.org", Resolv::DNS::Resource::IN::SRV).target'
An exception occurred evaluating command line code:

    Invalid argument - connect(2) (Errno::EINVAL)

Backtrace:

                                                            Errno.handle at kernel/common/errno.rb:17
                                                       UDPSocket#connect at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1321
                                                          UDPSocket#send at /home/mpapis/.rvm/rubies/rbx-2.2.5/gems/gems/rubysl-socket-2.0.1/lib/rubysl/socket.rb:1328
                     Resolv::DNS::Requester::UnconnectedUDP::Sender#send at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:792
  Resolv::DNS::Requester(Resolv::DNS::Requester::UnconnectedUDP)#request at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:673
                                       { } in Resolv::DNS#fetch_resource at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:529
                                       { } in Resolv::DNS::Config#resolv at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:1093
                                                              Array#each at kernel/bootstrap/array.rb:66
                                       { } in Resolv::DNS::Config#resolv at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:1091
                                                              Array#each at kernel/bootstrap/array.rb:66
                                       { } in Resolv::DNS::Config#resolv at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:1090
                                                              Array#each at kernel/bootstrap/array.rb:66
                                              Resolv::DNS::Config#resolv at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:1088
                                              Resolv::DNS#fetch_resource at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:520
                                               Resolv::DNS#each_resource at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:510
                                                 Resolv::DNS#getresource at /home/mpapis/.rvm/gems/rbx-2.2.5@global/gems/rubysl-resolv-2.1.0/lib/rubysl/resolv/resolv.rb:491
                                                { } in Object#__script__ at -e:1
                             Rubinius::BlockEnvironment#call_on_instance at kernel/common/block_environment.rb:53
                                           Kernel(Rubinius::Loader)#eval at kernel/common/eval.rb:176
                                                  Rubinius::Loader#evals at kernel/loader.rb:616
                                                   Rubinius::Loader#main at kernel/loader.rb:830

and it does not look like the bootstraped load path, it looks like exactly bootstraped gems - because I have installed the gem into the path and it did not helped

Owner

YorickPeterse commented Feb 28, 2014

Hm that is interesting, especially now that rubysl-resolv uses the same code as the latest release of MRI. I'll see if I can do some extra digging the coming few days.

Contributor

mpapis commented Feb 28, 2014

from the trace I can see that the new gem was not used - so it might be fixed but ruinius does not want to use the new gem

Owner

YorickPeterse commented Feb 28, 2014

The trace mentions going through rubysl-resolv 2.1.0, which is the Gem version. As such I suspect there might be an issue in rubysl-socket or the problem is unrelated to the fixes made in https://bugs.ruby-lang.org/issues/9477 and caused by something else.

Contributor

mpapis commented Feb 28, 2014

ah I mentioned the 9477 only as a similar problem:

btw. there was similar problem for IPV6 recently for MRI https://bugs.ruby-lang.org/issues/9477

I did mentioned it only to point out that this kind of problems is meant to be catched and handled so developer/end user does not have to think "what a mysterious problem" ;)

YorickPeterse removed their assignment Mar 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment