views:

174

answers:

1

I originally posted a question relating to this problem on serverfault.com: http://serverfault.com/questions/152587/apache-mod-proxy-to-another-server

I have since realized that this is not an issue with my server setup, but my rails application. I have set this application up server-wise the exact same as another functioning rails app I have running on the same server. When I start the server my mongrel.log looks like this:

** Daemonized, any open files are closed.  Look at /var/www/osuwebdev/tmp/pids/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:8080
** Starting Rails with production environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:8080
** Writing PID file to /var/www/osuwebdev/tmp/pids/mongrel.pid

When I load a page this pops up in the log:

Wed Jun 30 19:46:10 +0000 2010: Error calling Dispatcher.dispatch #<NoMethodError: undefined method `[]' for nil:NilClass>
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:135:in `out'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81:in `process'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:282:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
/var/lib/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/local/bin/mongrel_rails:19:in `load'
/usr/local/bin/mongrel_rails:19

I cannot figure out what is different about this app that may cause this issue.

A: 

Do you still see the problem on subsequent GET requests? I had a similar problem where my Rails app would run fine under WEBrick but not under Mongrel but found somewhere on the internets (here's a link that shows a similar version of the problem) that older versions of Mongrel mishandle the first request to the page but handle subsequent requests ok.

The workaround we put in was that whenever we started the app, we'd have curl perform a GET on the app to 'prime' Mongrel.

Chris Bunch
It is on every request
trobrock