Bugs item #28561, was opened at 2010-09-12 10:27 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=575&aid=28561&group_id=126
Category: #gem and #require methods Group: None Status: Open Resolution: None Priority: 3 Submitted By: Jeremy Evans (jeremyevans) Assigned to: Nobody (None) Summary: Doesn't check that the current thread already has the mutex in Gem.searcher Initial Comment: Gem.search doesn't check that the current thread already has the mutex. In certain cases, it's possible that it will call itself when it already has the mutex. See http://github.com/jeremyevans/home_run/issues/issue/13. For example, this backtrace shows that searcher can call itself recursively (see ****): C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:840:in `synchronize': thread 0x4394f10 tried to join itself (ThreadError) ****from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:840:in `searcher' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in `require' from C:/Ruby187/lib/ruby/site_ruby/1.8/date.rb:2 from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from C:/Ruby187/lib/ruby/1.8/yaml/rubytypes.rb:2 from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from C:/Ruby187/lib/ruby/1.8/yaml.rb:396 from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:220:in `load_file' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:168:in `initialize' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:385:in `new' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:385:in `configuration' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:635:in `path' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:68:in `installed_spec_directories' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:58:in `from_installed_gems' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:883:in `source_index' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:81:in `init_gemspecs' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:13:in `initialize' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:841:in `new' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:841:in `searcher' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:840:in `synchronize' ****from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:840:in `searcher' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:479:in `find_files' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:983:in `load_plugins' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:1139 from ./script/../config/boot.rb:90:in `require' from ./script/../config/boot.rb:90:in `load_rubygems' from ./script/../config/boot.rb:53:in `load_initializer' from ./script/../config/boot.rb:38:in `run' from ./script/../config/boot.rb:11:in `boot!' from ./script/../config/boot.rb:114 from script/console:2:in `require' from script/console:2 You can prevent this by checking if current thread already has the mutex, and not doing MUTEX.synchronize if so. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=575&aid=28561&group_id=126 _______________________________________________ Rubygems-developers mailing list http://rubyforge.org/projects/rubygems Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers