[Mongrel] mongrel startup fails now: already initialized constant OPTIONS

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

>Works for me. Do you have any strange gem_plugins installed? Maybe try
>uninstalling the old version of mongrel::cluster?

I've got to drive home now. I'll be back online in a couple of hours. I think it might be some kind of gem error.

This is where I've gotten to:

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})
   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

I set an exception capture here for the NoMethodError

cat NoMethodError

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

(rdb:1) cont
/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          => "",
   14    :environment => (ENV['RAILS_ENV'] || "development").dup,
   15    :detach      => false
   16  }
=> 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:") { |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 Mongrel-users mailing list