# Mongrel\_cluster restart problem with capistrano

**URL:** <https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892>\
**Category:** Deployment\
**Created:** [January 30, 2007, 4:01pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892 "2007-01-30T16:01:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [January 30, 2007, 4:01pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/1 "2007-01-30T16:01:43Z")

</div>

I’m having an issue every time I deploy where my mongrel\_cluster isn’t  
being restarted and I have to do the mongrel\_cluster::restart command  
myself manually through the terminal on my server.

I’ve pasted my config/deploy.rb file here for you to see:

[http://pastie.caboo.se/36705](http://pastie.caboo.se/36705)

Here is my config/mongrel\_cluster.yml file:

* * *

cwd: /var/www/rp-portal/current  
port: “8000”  
environment: production  
pid\_file: log/mongrel.pid  
servers: 2

I am using a hardware load balancer, that is why I dont have the address  
line in the mongrel config file.

any ideas why the deploy task won’t restart by cluster? I don’t receive  
any errors in the output, in fact the output tells me

Stopping 2 Mongrel servers…  
Starting 2 Mongrel servers…

which means to me it worked fine. but of course it didnt.

---

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [February 11, 2007, 8:44pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/2 "2007-02-11T20:44:43Z")

</div>

Hi Craig,  
I’ve just started using Capistrano and am having the same problem.  
When deploying or rolling back, the mongrel cluster (3 instances)  
fails to restart nearly every time. The PID files are not being  
deleted when the cluster is stopped and so when it tries to start the  
cluster again it fails because the PIDs exist.

Other times it has started the cluster but spawned 6-9 mongrel  
instances.

Like yourself I’ve had to resort to restarting the cluster manually  
which isn’t ideal.

Did you find a solution to this problem? Or, would anybody else be  
able to assist with this?

Thanks in advance for any help.

Regards,

Niall M.  
[http://www.4L.ie/](http://www.4L.ie/)

On Jan 30, 3:01 pm, Craig J. \<ruby-forum-incom…@andreas-

---

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [February 11, 2007, 10:06pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/3 "2007-02-11T22:06:52Z")

</div>

Niall,

I still have not found a solution to this problem. Since you have  
tracked it down to the fact that the PID files aren’t being deleted, I  
may be able to work up a solution. I’ll take a look and see if I can  
come up with anything

- Craig

Niall M. wrote:

> Hi Craig,  
> I’ve just started using Capistrano and am having the same problem.  
> When deploying or rolling back, the mongrel cluster (3 instances)  
> fails to restart nearly every time. The PID files are not being  
> deleted when the cluster is stopped and so when it tries to start the  
> cluster again it fails because the PIDs exist.
> 
> Other times it has started the cluster but spawned 6-9 mongrel  
> instances.
> 
> Like yourself I’ve had to resort to restarting the cluster manually  
> which isn’t ideal.
> 
> Did you find a solution to this problem? Or, would anybody else be  
> able to assist with this?
> 
> Thanks in advance for any help.
> 
> Regards,
> 
> Niall M.  
> [http://www.4L.ie/](http://www.4L.ie/)
> 
> On Jan 30, 3:01 pm, Craig J. \<ruby-forum-incom…@andreas-

---

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [February 22, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/4 "2007-02-22T15:55:30Z")

</div>

I had same problem. Seems to be fixed after I changed the setting for  
pid\_file in in mongrel\_cluster.yml to absolute path.

Ronald Sacher

---

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [February 12, 2007, 11:56am UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/5 "2007-02-12T11:56:44Z")

</div>

Thanks for the reply Craig.

Capistrano was throwing the error about the PID files which is how I  
found out about it. If you weren’t seeing an error in the Capistrano  
log then you may be having a different problem.

The puzzling thing is, a direct command line call to ‘mongrel\_rails  
cluster::restart’ deletes the PID files correctly. But when  
Capistrano calls that function it seems to have problems.

I’m wondering if it’s an issue with the location of the PID files -  
perhaps they need to be in shared/pids and not log/? I’m going to  
examine the mongrel\_cluter/recipes file to see if I can track down the  
problem and report back.

Please let me know if you make any progress.

Cheers,

Niall M.  
[http://www.4L.ie/](http://www.4L.ie/)

On Feb 11, 9:06 pm, Craig J. \<ruby-forum-incom…@andreas-

---

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [February 27, 2007, 3:53am UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/6 "2007-02-27T03:53:23Z")

</div>

Craig J. wrote:

> Ronald Sacher wrote:
> 
> > I had same problem. Seems to be fixed after I changed the setting for  
> > pid\_file in in mongrel\_cluster.yml to absolute path.
> > 
> > Ronald Sacher
> 
> Ronald, you just did the absolute path to your  
> /app/current/log/mongrel.pid i assume, correct?

The problem with restarting is that capistrano has not linked the  
tmp/pids directory back before it calls restart. So basically, unless  
you’re passing hte path to your ‘shared’ pids directory it’ll always  
fail miserably. ☹

my mongrel cluster.yml file looks like this  
pid\_file: /home/production/Sites/milestone/shared/pids/mongrel.pid

Where ‘current\_path’ is normally  
/home/production/Sites/milestone/current

Hope this helps.

---

<div class="post-metadata">

**Author:** ![cpjolicoeur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@cpjolicoeur](https://www.ruby-forum.com/u/cpjolicoeur)\
**Post date:** [February 22, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/mongrel-cluster-restart-problem-with-capistrano/83892/7 "2007-02-22T15:59:14Z")

</div>

Ronald Sacher wrote:

> I had same problem. Seems to be fixed after I changed the setting for  
> pid\_file in in mongrel\_cluster.yml to absolute path.
> 
> Ronald Sacher

Ronald, you just did the absolute path to your  
/app/current/log/mongrel.pid i assume, correct?
