Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Uninitialized constant Bundler::Plugin::API::Source. #5409

Closed
dekellum opened this issue Feb 7, 2017 · 18 comments
Closed

Uninitialized constant Bundler::Plugin::API::Source. #5409

dekellum opened this issue Feb 7, 2017 · 18 comments
Assignees

Comments

@dekellum
Copy link
Contributor

dekellum commented Feb 7, 2017

Seems this issue has reappeared in bundler 1.14.x in combination with 2.4.x rubygems. See:

https://travis-ci.org/dekellum/syncwrap/jobs/197069321#L202

Its not an issue with either rubygems 2.6.x (2.6.6 in one env.), or with bundler 1.13.7 as I'm able to demonstrate here:

https://travis-ci.org/dekellum/syncwrap/jobs/197079264

I think this is very similar to reports and PR #4981.

If the rake project can reproduce the issue, we don't know via travis, given that its pegged to bundler 1.13.x:

https://github.com/ruby/rake/blob/34f5e2e27d2c49431b7c84d0787eaf6afcddf794/.travis.yml

Cc: @hsbt

But here are some other reports of this with bundler 1.14.3:

@segiddins
Copy link
Member

We really need a test case that reproduces this, since I can't reproduce it on any of the ruby apps I have lying around

@hackergil
Copy link

Experiencing the same issue on a rails app using rubygems 2.4.8 and bundler 1.14.3

@hackergil
Copy link

I have just updated my rubygems to 2.6.10 and the issue is gone fyi.

@colby-swandale
Copy link
Member

ping @dekellum

Are you still experiencing your reported issue?

@dekellum
Copy link
Contributor Author

Yes:

https://travis-ci.org/dekellum/syncwrap/jobs/203321757#L208

It seems impossible to test this in Bundler's test environment. My only guess here is that there is something recursive going on with use of auto-load in bundler that isn't working well. See also #4981.

@indirect
Copy link
Member

@dekellum that example is limited to Bundler 1.13.x, which does not contain the fix. Please try again with Bundler 1.14.x and report back.

@dekellum
Copy link
Contributor Author

That failing build was in fact using bundler 1.14.4:

https://travis-ci.org/dekellum/syncwrap/jobs/203321757#L195

But it did confusingly contain an incomplete attempt to workaround via bundler 1.13.x. Here is a pristine .travis.yml and a freshly failing build also using bundler 1.14.4:

https://travis-ci.org/dekellum/syncwrap/jobs/203484794#L200

@colby-swandale
Copy link
Member

colby-swandale commented Feb 20, 2017

@dekellum can you please update Ruby Gems to the latest version in travis.

@dekellum
Copy link
Contributor Author

dekellum commented Feb 20, 2017

@colby-swandale, are just asking me to do that in order to further probe the possible cause of the problem? I can add that change on another disposable branch. Can you point me at a .travis.yml recipe for rubygems update?

But I have no doubt that later versions of rubygems (2.6.x, as stated in my initial report) will not exhibit this problem. Are you stating that bundler, as of 1.14.4 at least, is dropping support for this older version of rubygems?

I have no idea why the Travis environment is defaulting to this problem combination of the newest version of Bundler and this old version of Rubygems. A stock ruby 2.2.6p396 (version I'm testing) includes rubygems 2.4.5.2. Not sure if its RVM that is changing it to 2.4.8 or if the stock version has later backported fixes?

@dekellum
Copy link
Contributor Author

So I just confirmed: I can reproduce this on both (ruby 2.2.6 stock) rubygems 2.4.5.2 and (Travis/RVMs) rubygems 2.4.8.

@indirect
Copy link
Member

@dekellum thank you for checking! Is there anything you can tell us that would help us figure out how to reproduce this issue outside of a Travis build environment? We'd like to fix it, but it's very hard to know if we have without a reliable reproduction case to test against.

@segiddins
Copy link
Member

@dekellum I couldn't reproduce that failure locally using rubygems 2.4.8 and ruby 2.2.4, I'll try downloading 2.2.6 when I get to better internet

@dekellum
Copy link
Contributor Author

I was able to reproduce it in my local dev environment with stock ruby 2.2.6, rubygems 2.4.5.2, once I removed all traces of a prior rubygems-update. The travis build gives good detail on repro. steps.

@dekellum
Copy link
Contributor Author

Here is warnings, stack trace via ruby -d in the same dev environment:

/home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/rubygems_ext.rb:45: warning: loading in progress, circular require considered harmful - /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/plugin/api/source.rb
	from /home/david/bin/rake:22:in  `<main>'
	from /home/david/bin/rake:22:in  `load'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/exe/rake:27:in  `<top (required)>'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:77:in  `run'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in  `standard_exception_handling'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:79:in  `block in run'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:95:in  `load_rakefile'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in  `standard_exception_handling'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:96:in  `block in load_rakefile'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:686:in  `raw_load_rakefile'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/rake_module.rb:28:in  `load_rakefile'
	from /home/david/.gem/ruby/2.2.0/gems/rake-11.3.0/lib/rake/rake_module.rb:28:in  `load'
	from /home/david/src/syncwrap/Rakefile:4:in  `<top (required)>'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in  `require'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in  `rescue in require'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in  `require'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/setup.rb:10:in  `<top (required)>'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:94:in  `setup'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:128:in  `definition'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/definition.rb:33:in  `build'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/dsl.rb:11:in  `evaluate'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/dsl.rb:41:in  `eval_gemfile'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/dsl.rb:41:in  `instance_eval'
	from /home/david/src/syncwrap/Gemfile:5:in  `eval_gemfile'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/dsl.rb:60:in  `gemspec'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/dsl.rb:60:in  `map'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/dsl.rb:60:in  `block in gemspec'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:407:in  `load_gemspec'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:417:in  `load_gemspec_uncached'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/shared_helpers.rb:54:in  `chdir'
	from /usr/lib/ruby/2.2.0/monitor.rb:211:in  `mon_synchronize'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/shared_helpers.rb:55:in  `block in chdir'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/shared_helpers.rb:55:in  `chdir'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:422:in  `block in load_gemspec_uncached'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:474:in  `eval_gemspec'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:474:in  `eval'
	from /home/david/src/syncwrap/syncwrap.gemspec:3:in  `<main>'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in  `gem'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in  `synchronize'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:67:in  `block in gem'
	from /usr/lib/ruby/2.2.0/rubygems/specification.rb:1283:in  `activate'
	from /usr/lib/ruby/2.2.0/rubygems/specification.rb:1370:in  `add_self_to_load_path'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in  `full_require_paths'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in  `map'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:145:in  `block in full_require_paths'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/rubygems_ext.rb:45:in  `full_gem_path'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/plugin/api/source.rb:2:in  `<top (required)>'
	from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:74:in  `require'
	from /usr/lib/ruby/2.2.0/rubygems/specification.rb:949:in  `find_in_unresolved'
	from /usr/lib/ruby/2.2.0/rubygems/specification.rb:949:in  `find_all'
	from /usr/lib/ruby/2.2.0/rubygems/specification.rb:949:in  `each'
	from /usr/lib/ruby/2.2.0/rubygems/specification.rb:949:in  `block in find_in_unresolved'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:77:in  `contains_requirable_file?'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in  `full_require_paths'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in  `map'
	from /usr/lib/ruby/2.2.0/rubygems/basic_specification.rb:145:in  `block in full_require_paths'
	from /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/rubygems_ext.rb:45:in  `full_gem_path'
Exception `NameError' at /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/rubygems_ext.rb:45 - uninitialized constant Bundler::Plugin::API::Source
Exception `NameError' at /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler/rubygems_ext.rb:45 - uninitialized constant Bundler::Plugin::API::Source
Exception `NameError' at /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:474 - uninitialized constant Bundler::Plugin::API::Source
Exception `Bundler::GemspecError' at /home/david/.gem/ruby/2.2.0/gems/bundler-1.14.4/lib/bundler.rb:482 - 
[!] There was an error while loading `syncwrap.gemspec`: uninitialized constant Bundler::Plugin::API::Source. Bundler cannot continue.

 #  from /home/david/src/syncwrap/syncwrap.gemspec:3
 #  -------------------------------------------
 #  
 >  require 'rjack-tarpit/spec' if gem 'rjack-tarpit', '~> 2.1'
 #  
 #  -------------------------------------------

No such warning or stack trace with rubygems 2.6.10.

dekellum added a commit to dekellum/syncwrap that referenced this issue Feb 21, 2017
This appears to be another viable workaround, suggesting that
the auto-loads are not behaving as intended.

github: rubygems/bundler#5409
@dekellum
Copy link
Contributor Author

A simple require as in dekellum/syncwrap@cd5df2a is also a valid workaround:

https://travis-ci.org/dekellum/syncwrap/jobs/203932154

@segiddins
Copy link
Member

Thanks for the stack trace for the circular require -- I think that gives me enough information to fix the bug!

@segiddins segiddins self-assigned this Feb 21, 2017
bundlerbot added a commit that referenced this issue Feb 21, 2017
…efined, r=indirect

Avoid undefined Bundler::Plugin::API::Source exception

Fixes #5409, with a test!
@imechemi
Copy link

imechemi commented Mar 2, 2017

I saw somewhere who has shared what they did, and I couldn't find that. I am sharing it again here:

  1. gem update --system
  2. If the above command does not work, Refer the steps mentioned here (http://guides.rubygems.org/ssl-certificate-update/)
  3. Install the latest bundler
  4. Then bundle once again or uninstall and reinstall whatever gem you're trying to use.

This worked for me using with the change from #5459

Thanks 😃

segiddins pushed a commit that referenced this issue Mar 3, 2017
…efined, r=indirect

Avoid undefined Bundler::Plugin::API::Source exception

Fixes #5409, with a test!

(cherry picked from commit 02ceb08)
@jchan172
Copy link

Thanks @imechemi! This fixed it for me.

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

No branches or pull requests

7 participants