[Mongrel] cluster::restart doesn't wait for stop before starting

Dave Cheney dave at cheney.net
Sun Oct 28 09:57:18 EDT 2007

We notice this a lot in our environment because some mongrels in the  
cluster are assigned to handle image magick tasks and can take a while  
to acknowledge the TERM signal.

 From my understanding mongrel_rails cluster::restart sends a TERM to  
each mongel, which causes it to wait for the currently processing  
request to finish, then closes the connections of the other requests  
outstanding. If this doesn't happen straight away then you'll get the  
already started message.

The solution to me would seam to give cluster::restart an optional  
delay parameter so those slow mongrels can catch up.



On 28/10/2007, at 11:40 AM, Andrew Vit wrote:

> Hi,
> I'm calling restart from my Capistrano task. I have this in my  
> deploy.rb file:
> # until mongrel_cluster updates to cap2...
> namespace :deploy do
> task :start,    :roles => :app do start_mongrel_cluster end
> task :stop,     :roles => :app do stop_mongrel_cluster end
> task :restart,  :roles => :app do restart_mongrel_cluster end
> end
> (What's the scoop on mongrel_cluster with Capistrano 2 by the way?)
> The command that's executed with a restart is:
> sudo mongrel_rails cluster::restart -C /etc/mongrel_cluster/ 
> staging.yml
> ** [out ::] stopping port 8010
> ** [out ::] already started port 8010
> At this point the server is not running -- I conclude that it has been
> stopped successfully. Now if I call on "start" it starts properly
> without an "already started" warning.
> This happens intermittently. Sometimes it restarts fine. If I call
> stop/start manually, it works because I guess I'm leaving enough time
> in between for it to shut down.
> Any thoughts on this?
> capistrano 2.0.0
> mongrel 1.0.1
> mongrel_rails 1.0.2
> --Andrew Vit
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list