Welcome Guest | Login

Restarting Mongrel

Whenever Capistrano redeploys a new version of my app, I notice that the command "mongrel_rails restart" does not cause mongrel to serve up this newer version but instead keep serving the old version. Cap does report that a USR2 signal has been sent to Mongrel and the PID is changed as a result.

However, if I stop mongrel manually and start it with the command "mongrel_rails -e production -p xxxx -d", it works as intended.

I'm wondering why the "restart" fails to do the job and the difference between the two.

2007-08-26 08:59 AM

"restart" should theoretically issue a stop and then start.  If you replace in a "mongrel_rails stop && mongrel_rails -e production -p xxxx -d" in your task does that work?  What code are you using in your Capfile, exactly?  

2007-08-26 10:11 AM

Hi William,

Not working...

task :restart, :roles => :app do
   run "cd #{current_path} && mongrel_rails restart"
end

Working...

task :restart, :roles => :app do
   run "cd #{current_path} && mongrel_rails stop"
   run "cd #{current_path} && mongrel_rails start -e production -p xxxx -d"
end

Thank you.

2007-08-26 11:21 PM

I remember hearing stories about this in the early days of Mongrel, but I had thought the newer versions had fixed the restart issues.  Its possible there could be something in your app, or perhaps the amount/type of traffic you're getting, that's preventing it from working.  We haven't had a report of this problem in over a year, however.  I suppose the quick fix may be the easiest.  

2007-08-27 12:40 AM

Actually- with recent version of Mongrel running on Ruby 1.8.6, that cgi_multipart EOF fix is not needed.  Its possible that when cap issues the "cd #{current_path} && mongrel_rails restart" it gets confused by that warning message.  You can test it by just issuing a mongrel_rails restart yourself and seeing what happens.

2007-08-27 04:43 AM

Hi,

Same prob issuing a manual mongrel_rails restart.
Anyway I'm going for the quick fix as this is not a big issue. But "restart" is more elegant if it works.

Thanks.

2007-08-27 07:25 AM

Hello,

Just wanted to add that I experienced the exact same problem: "mongrel_rails restart" doesn't run the new code, but "mongrel_rails stop && mongrel_rails start -e production -p xxxx -d" does.

2007-09-04 01:56 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.