[Rubygems-developers] getting an error using mongrel that might be gem related

Stephen Bannasch stephen.bannasch at deanbrook.org
Tue Nov 13 17:19:55 EST 2007


Posted here in case this really is gem related and someone's seen it 
or something like it before. I think the problem may be in:

   GemPlugin::Manager.instance.load

but I'm not sure at all yet.

-----------------------------

After I updated to ruby 1.8.6p111 last night and updated some gems and now
mongrel doesn't work:

MacOS 10.4.10

$ ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-darwin8.10.1]

$ gem list rails

*** LOCAL GEMS ***

rails (1.2.5, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.6)

Here's a simple test:

$ rails test5
        create  ...

$ cd test5
$ script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
Exiting
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb:15: 

warning: already initialized constant OPTIONS
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb:18: 

undefined method `options' for []:Array (NoMethodError)
          from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
          from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`require'
          from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in 

`require'
          from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in 

`new_constants_in'
          from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in 

`require'
          from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39
          from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
          from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'

Here were the gems I upgraded:

    $ gem outdated
    Bulk updating Gem source index for: http://gems.rubyforge.org
    fastercsv (1.2.0 < 1.2.1)
    ruby-debug (0.8.1 < 0.9.3)
    mofo (0.2.1 < 0.2.10)
    mongrel (1.0.1 < 1.1.1)
    rails (1.2.4 < 1.2.5)
    actionwebservice (1.2.4 < 1.2.5)
    ruby-debug-base (0.8.1 < 0.9.3)
    activerecord (1.15.4 < 1.15.5)
    tzinfo (0.3.3 < 0.3.5)
    gem_plugin (0.2.2 < 0.2.3)
    libxml-ruby (0.3.8.4.1 < 0.5.2.0)
    ruport (0.8.12 < 1.2.2)
    image_science (1.1.1 < 1.1.3)
    erubis (2.2.0 < 2.4.1)
    uuidtools (1.0.0 < 1.0.2)
    cgi_multipart_eof_fix (2.1 < 2.5.0)
    attributes (4.0.0 < 5.0.0)
    net-ssh (1.0.10 < 1.1.2)
    mongrel_cluster (1.0.2 < 1.0.4)
    capistrano (1.4.1 < 2.1.0)
    merb (0.2.0 < 0.4.1)
    actionmailer (1.3.4 < 1.3.5)
    actionpack (1.13.4 < 1.13.5)
    json (1.0.1 < 1.1.1)
    daemons (1.0.5 < 1.0.9)
    RubyInline (3.6.2 < 3.6.5)
    activesupport (1.4.3 < 1.4.4)
    builder (2.1.1 < 2.1.2)
    hpricot (0.5.110 < 0.6)
    fastthread (1.0 < 1.0.1)

--------------------------------------

Some more clues from tracing with ruby-debug (I'm still learning how 
o use this tool):

dev mode, rails 1.2.5, ruby 1.8.6 patchlevel 111, gem v0.9.4
this is on a newly created rails app with no changes to it

I set a debugger statement at the end of environment.rb and run script/server.

When it fires I set this breakpoint:

b /usr/local/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:114

This is in the middle of the GemPlugin::Manager.instance.load loop 
where gems are loaded which is called from load_plugins line 231 in 
in mongrels configurator.rb.

(rdb:1) where
--> #0 
/usr/local/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:114 
in 'load'
     #1 /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:166 in 'each'
     #2 
/usr/local/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112 
in 'load'
     #3 
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/configurator.rb:231 
in 'load_plugins'
     #4 
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails:117 
in 'cloaker_'
(rdb:1) l 112
[107, 116] in 
/usr/local/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb
    107      def load(needs = {})
    108        sdir = File.join(Gem.dir, "specifications")
    109        gems = Gem::SourceIndex.from_installed_gems(sdir)
    110        needs = needs.merge({"gem_plugin" => INCLUDE})
    111 
    112        gems.each do |path, gem|
    113          # don't load gems more than once
=> 114          next if @gems.has_key? gem.name       
    115          check = needs.dup


gems.length => 315

I set an exception capture here for the NoMethodError

cat NoMethodError

then 34 times through this loop (many 'conts')

(rdb:1) cont
Exiting
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb:15: 
warning: already initialized constant OPTIONS
Catchpoint at 
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb:18: 
`undefined method `options' for []:Array' (NoMethodError)
         from 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`gem_original_require'
         from 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`require'
         from script/server:3
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb:18 
ARGV.clone.options do |opts|
[13, 22] in 
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb
    13    :ip          => "0.0.0.0",
    14    :environment => (ENV['RAILS_ENV'] || "development").dup,
    15    :detach      => false
    16  }
    17 
=> 18  ARGV.clone.options do |opts|
    19    opts.on("-p", "--port=port", Integer, "Runs Rails on the 
specified port.", "Default: 3000") { |v| OPTIONS[:port] = v }
    20    opts.on("-b", "--binding=ip", String, "Binds Rails to the 
specified ip.", "Default: 0.0.0.0") { |v| OPTIONS[:ip] = v }
    21    opts.on("-d", "--daemon", "Make server run as a Daemon.") { 
OPTIONS[:detach] = true }
    22    opts.on("-e", "--environment=name", String,


More information about the Rubygems-developers mailing list