Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when Gem::Specification.load fails? #1287

Closed
danielsdeleo opened this issue Jun 12, 2015 · 1 comment
Closed

Warn when Gem::Specification.load fails? #1287

danielsdeleo opened this issue Jun 12, 2015 · 1 comment

Comments

@danielsdeleo
Copy link

In our test environment for ChefDK packages, we intermittently see errors like:

/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:762:in `block in _resort!': undefined method `name' for nil:NilClass (NoMethodError)
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:761:in `sort!'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:761:in `_resort!'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:713:in `_all'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:896:in `each'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:300:in `find_all'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:300:in `to_specs'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:324:in `to_spec'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:58:in `gem'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems.rb:595:in `load_yaml'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:328:in `load_file'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:197:in `initialize'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems.rb:291:in `new'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems.rb:291:in `configuration'
    from /opt/chefdk/embedded/apps/chef/lib/chef/provider/package/rubygems.rb:48:in `<class:GemEnvironment>'

This error is triggered when we call Gem.configuration at load time in our code. I am unable to consistently reproduce this error, so I am not able to say currently what causes it. However, I noticed there are several cases where Gem::Specification.load can return nil, which seems to be part of the problem. I understand the behavior cannot be changed, but if possible I would like this case to issue a warning, which would assist me in debugging the above issue.

I am currently attempting to reproduce the issue using a patched rubygems with the following warnings added:

danielsdeleo@039890d

Is this something that would be acceptable? Or is there valid usage of Gem::Specification.load that should return nil ?

jtimberman pushed a commit to chef-boneyard/pcb that referenced this issue Jul 7, 2015
There is a bug in the ChefDK release installed on the build nodes that
causes an exception when running the unit tests. Reference:

- chef-boneyard/chef-dk#411
- rubygems/rubygems#1287

We think we can run unit phase again after ChefDK 0.7.0 (final
release) is installed on the build nodes.
@copiousfreetime
Copy link
Contributor

@danielsdeleo were you ever able to reproduce this bug?

It looks like the current versions of rubygems do warn if Gem::Specification.load is ever going to return nil. So I'm closing for now unless this can be reproduced.

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

No branches or pull requests

3 participants