views:

356

answers:

1

I just installed Ruby Enterprise Edition and Passenger on an Ubuntu Hardy 8.04 VPS. As far as I'm aware, the installation was successful. My Rails application is accessible and on the whole, works fine. However, the part of my application where users can post comments using AJAX doesn't work. My Comment model has a setter method for the request as per Railscasts episode 65:

def request=(request) 
  logger.info '*** Entered request setter method ***' # <- Never output!
  self.ip_address = request.remote_ip
  self.user_agent = request.env['HTTP_USER_AGENT']
  self.referrer   = request.env['HTTP_REFERER']
end

Everything works fine in development, but in production this method is never invoked and I get an HTTP 500 error when trying to post a comment. My production log is shown below.

I'm kind of at a loss as to how to debug this one, so would appreciate any pointers! I don't know what's trying to monkey-patch the Fixnum class with an each method.

EDIT: It turns out that there's a known issue with the Hoptoad exception notifier that explains the Fixnum issue. It still doesn't explain why my request setter isn't called by REE though!


production.log

Aug 08 17:06:14 railsapp rails[4666]: "\nNoMethodError (undefined method each' for 1:Fixnum):\n passenger (2.2.4) lib/phusion_passenger/rack/request_handler.rb:91:in process_request'\n passenger (2.2.4) lib/phusion_passenger/abstract_request_handler.rb:206:in main_loop'\n passenger (2.2.4) lib/phusion_passenger/railz/application_spawner.rb:376:in start_request_handler'\n passenger (2.2.4) lib/phusion_passenger/railz/application_spawner.rb:334:in handle_spawn_application'\n passenger (2.2.4) lib/phusion_passenger/utils.rb:182:in safe_fork'\n passenger (2.2.4) lib/phusion_passenger/railz/application_spawner.rb:332:in handle_spawn_application'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:351:in send'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:351:in main_loop'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:195:in start_synchronously'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:162:in start'\n passenger (2.2.4) lib/phusion_passenger/railz/application_spawner.rb:213:in start'\n passenger (2.2.4) lib/phusion_passenger/spawn_manager.rb:261:in spawn_rails_application'\n passenger (2.2.4) lib/phusion_passenger/abstract_server_collection.rb:126:in lookup_or_add'\n passenger (2.2.4) lib/phusion_passenger/spawn_manager.rb:255:in spawn_rails_application'\n passenger (2.2.4) lib/phusion_passenger/abstract_server_collection.rb:80:in synchronize'\n passenger (2.2.4) lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize'\n passenger (2.2.4) lib/phusion_passenger/spawn_manager.rb:254:in spawn_rails_application'\n passenger (2.2.4) lib/phusion_passenger/spawn_manager.rb:153:in spawn_application'\n passenger (2.2.4) lib/phusion_passenger/spawn_manager.rb:286:in handle_spawn_application'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:351:in __send__'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:351:in main_loop'\n passenger (2.2.4) lib/phusion_passenger/abstract_server.rb:195:in start_synchronously'\n\n" Aug 08 17:06:14 railsapp rails[4666]: "/!\\ FAILSAFE /!\\ Sat Aug 08 17:06:14 +0000 2009\n Status: 500 Internal Server Error\n undefined method each' for 1:Fixnum\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:489:in filter_parameters'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:496:in filter_parameters'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:495:in collect'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:495:in filter_parameters'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:489:in each'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:489:in filter_parameters'\n /home/deploy/public_html/railsapp/releases/20090808155352/vendor/plugins/hoptoad_notifier/lib/hoptoad_notifier.rb:309:in clean_notice'\n /home/deploy/public_html/railsapp/releases/20090808155352/vendor/plugins/hoptoad_notifier/lib/hoptoad_notifier.rb:235:in notify_hoptoad'\n /home/deploy/public_html/railsapp/releases/20090808155352/vendor/plugins/hoptoad_notifier/lib/hoptoad_notifier.rb:226:in rescue_action_in_public'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/rescue.rb:154:in rescue_action_without_handler'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/rescue.rb:74:in rescue_action'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:527:in send'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/base.rb:527:in process_without_filters'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/filters.rb:606:in process'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/rescue.rb:65:in call_with_exception'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/dispatcher.rb:91:in dispatch'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/dispatcher.rb:111:in _call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/dispatcher.rb:82:in initialize'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/vendor/rack-1.0.0-git/lib/rack/head.rb:9:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/vendor/rack-1.0.0-git/lib/rack/head.rb:9:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/vendor/rack-1.0.0-git/lib/rack/methodoverride.rb:24:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/params_parser.rb:15:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/session/abstract_store.rb:122:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/query_cache.rb:29:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in cache'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/query_cache.rb:9:in cache'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/query_cache.rb:28:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/failsafe.rb:26:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/vendor/rack-1.0.0-git/lib/rack/lock.rb:11:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/vendor/rack-1.0.0-git/lib/rack/lock.rb:11:in synchronize'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/vendor/rack-1.0.0-git/lib/rack/lock.rb:11:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib/action_controller/dispatcher.rb:106:in call'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/rack/request_handler.rb:91:in process_request'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_request_handler.rb:206:in main_loop'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:376:in start_request_handler'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:334:in handle_spawn_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/utils.rb:182:in safe_fork'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:332:in handle_spawn_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in send'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in main_loop'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:195:in start_synchronously'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:162:in start'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/railz/application_spawner.rb:213:in start'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:261:in spawn_rails_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server_collection.rb:126:in lookup_or_add'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:255:in spawn_rails_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server_collection.rb:80:in synchronize'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:254:in spawn_rails_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:153:in spawn_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/spawn_manager.rb:286:in handle_spawn_application'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in __send__'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:351:in main_loop'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/abstract_server.rb:195:in `start_synchronously'\n /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/bin/

A: 

Remove Hoptoad and try it again. From what I can tell in that textwall of a stack trace your controller isn't being called. It's blowing up trying to parse the incoming params.

jdl