DoubleRenderError Infinite Loop Mongrel Cluster

Hi Group,

A few days ago my production setup started going into a
DoubleRenderError loop. The problem is that I’m fairly certain that I
don’t have more than one call to redirect or render in the same
action. I tried rolling back my code to 10 versions back (when I know
the system was running great) and it still goes into this loop. It
doesn’t display the 500 error page and stop like it should, but goes
into a loop for a couple of minutes and skyrockets the server load to
where I can’t even login. When this happens one of my three
mongrel_rails clusters gets killed and I have to restart the cluster.
I can’t reproduce this loop and looking through the logs it seems to
just happen at any given time. I’m running Apache 2.2.3 with
mod_proxy_balancer to a cluster of three Mongrel servers.

This is the output from production.log

ActionController::DoubleRenderError (Render and/or redirect were
called multiple times in this action. Please no
te that you may only call render OR redirect, and only once per
action. Also note that neither redirect nor rend
er terminate execution of the action, so if you want to exit an action
after redirecting, you need to do somethi
ng like “redirect_to(…) and return”. Finally, note that to cause a
before filter to halt execution of the rest
of the filter chain, the filter must return false, explicitly, so
“render(…) and return false”.):
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/base.rb:840:in redirect_to' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/base.rb:854:inredirect_to’
/lib/user_system.rb:66:in access_denied' /lib/user_system.rb:56:inlogin_required’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/filters.rb:399:in send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/filters.rb:399:incall_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/filters.rb:394:in each' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/filters.rb:394:incall_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/filters.rb:383:in before_action' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/filters.rb:365:inperform_action_withou
t_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/benchmarking.rb:69:in perform_action_wi thout_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/benchmarking.rb:69:in perform_action_wi thout_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/rescue.rb:82:inperform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/base.rb:408:in send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/base.rb:408:inprocess_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/filters.rb:377:in process_without_sessi on_management_support' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/session_management.rb:117:inprocess’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
dispatch' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb: 84:inprocess’
/usr/lib/ruby/1.8/sync.rb:229:in
synchronize' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb: 83:inprocess’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in
process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:ineach’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in
process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:innew’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:ininitialize’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
new' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:267:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/ configurator.rb:266:ineach’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:266:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails: 127:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
command.rb:211:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails: 231 /usr/bin/mongrel_rails:18:inload’
/usr/bin/mongrel_rails:18

I’d appreciate any help I can get or a point in the right direction.

Thanks,
Scott Rogers

So this turned out to be a number of things. But interestingly, the
main culprit that was triggering the infinite loop was the various
search engine spiders.