# Mongrel complaining =\> pids and not up-to-date

**URL:** <https://www.ruby-forum.com/t/mongrel-complaining-pids-and-not-up-to-date/113289>\
**Category:** Deployment\
**Created:** [August 29, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/mongrel-complaining-pids-and-not-up-to-date/113289 "2007-08-29T15:59:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [August 29, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/mongrel-complaining-pids-and-not-up-to-date/113289/1 "2007-08-29T15:59:26Z")

</div>

Hi, Iâ€™ve got a Ubuntu 6.04 slice with the mongrel + rails stack all  
fully loaded, used the automatic setup guide from slicehost to do it.

However, little annoying problem, mongrel is always complaining at me  
that the Ruby version is not up to date, even though,

ruby -v  
returns 1.8.6

i installed the latest ruby build via wget, make, configure, make  
install and rebooted after that so i’m imagining it’s still using the  
old 1.8.4 version.

now iâ€™ve tried adding a line into my profile file via,

nano /etc/profile

and then adding

export PATH=/usr/local/sbin:/usr/local/bin:$PATH

to the beginning of the file but that didnâ€™t help.

maybe I have to SYMLINK the new version into place, but confused how to  
do this, any ideas?

also mongrel keeps making stale .pid files on startup & shutdown that I  
have to delete manually, any quick fix for that?

Appreciate any help you guys & girls can offer, sincerely and thanks in  
advance,

John.

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [August 31, 2007, 2:38am UTC](https://www.ruby-forum.com/t/mongrel-complaining-pids-and-not-up-to-date/113289/2 "2007-08-31T02:38:00Z")

</div>

Hi!

I think the best is to just ignore those compaints… I don’t know  
either…

But this will solve your stale PIDs problem:

[http://textsnippets.com/posts/show/931](http://textsnippets.com/posts/show/931)

I used this patch from the guy in the comments:

* * *

# Index: bin/mongrel\_rails

— bin/mongrel\_rails (revision 536)  
+++ bin/mongrel\_rails (working copy)  
@@ -83,9 +83,17 @@  
config = Mongrel::Rails::RailsConfigurator.new(settings) do  
if defaults[:daemon]  
if File.exist? defaults[:pid\_file]

- 

```
       log "!!! PID file #{defaults[:pid_file]} already exists. 

```

Mongrel c$

- 

```
       log "!!! Exiting with error. You must stop mongrel and 

```

clear the .$

- 

```
       exit 1

```

- 

```
       # mongrels that crash can leave stale PID files behind, and 

```

these

- 

```
       # should not stop mongrel from being restarted by 

```

monitors…

- 

```
       pid = File.new(defaults[:pid_file]).readline

```

- 

```
       running = Process.kill(0, pid.to_i) rescue nil

```

- 

```
       if running

```

- 

```
         log "!!! PID file #{defaults[:pid_file]} already exists 

```

and the p$

- 

```
         exit 1

```

- 

```
       else

```

- 

```
         log "!!! PID file #{defaults[:pid_file]} exists, but is 

```

stale, an$

- 

```
         File.delete(defaults[:pid_file])

```

- 

```
       end
     end

     daemonize

```

* * *

Apply it in mongrel directory (probably  
/usr/lib/ruby/gems/1.8/gems/mongrel-x.x.x/) by:  
patch -p0 \< /path/to/mongrel\_stale\_pid\_file.patch

I’m now going back troubleshooting my mongrel\_cluster autostart  
problem!? If anyone has ideas:

I can say “/etc/init.d/mongrel\_cluster start” and it starts just fine,  
but when I restart the system, it doesn’t start…

I did issue:  
“sudo update-rc.d mongrel\_cluster defaults” and got:  
Adding system startup for /etc/init.d/mongrel\_cluster …  
/etc/rc0.d/K20mongrel\_cluster → …/init.d/mongrel\_cluster  
/etc/rc1.d/K20mongrel\_cluster → …/init.d/mongrel\_cluster  
/etc/rc6.d/K20mongrel\_cluster → …/init.d/mongrel\_cluster  
/etc/rc2.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster  
/etc/rc3.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster  
/etc/rc4.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster  
/etc/rc5.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster

Strange, very strange!!  
nginx is starting fine… I tried to remove / add nginx links with  
update-rc.d and it still worked… but cluster just won’t start… What  
could possibly be causing this?

David

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [August 31, 2007, 12:46pm UTC](https://www.ruby-forum.com/t/mongrel-complaining-pids-and-not-up-to-date/113289/3 "2007-08-31T12:46:25Z")

</div>

update:

I found out that the init script does get called with START parameter…  
but it exits here:

# Gracefully exit if the controller is missing.

which mongrel\_cluster\_ctl \>/dev/null || exit 0

I then commented out this line and it went forward, but still didn’t  
start mongrels… I guess there is a problem and it exits rightfully…  
but I don’t see how there is no problem when I run the init script  
manually.

I’m pretty close now, but would still like to hear if anyone had a  
similiar problem… thank you

D. Krmpotic wrote:

> Hi!
> 
> I think the best is to just ignore those compaints… I don’t know  
> either…
> 
> But this will solve your stale PIDs problem:
> 
> [textsnippets.com](http://textsnippets.com/posts/show/931)
> 
> I used this patch from the guy in the comments:
> 
> * * *
> 
> # Index: bin/mongrel\_rails
> 
> — bin/mongrel\_rails (revision 536)  
> +++ bin/mongrel\_rails (working copy)  
> @@ -83,9 +83,17 @@  
> config = Mongrel::Rails::RailsConfigurator.new(settings) do  
> if defaults[:daemon]  
> if File.exist? defaults[:pid\_file]
> 
> - 
> 
> ```
> log "!!! PID file #{defaults[:pid_file]} already exists. 
> 
> ```
> 
> Mongrel c$
> 
> - 
> 
> ```
> log "!!! Exiting with error. You must stop mongrel and 
> 
> ```
> 
> clear the .$
> 
> - 
> 
> ```
> exit 1
> 
> ```
> 
> - 
> 
> ```
> # mongrels that crash can leave stale PID files behind, and 
> 
> ```
> 
> these
> 
> - 
> 
> ```
> # should not stop mongrel from being restarted by 
> 
> ```
> 
> monitors…
> 
> - 
> 
> ```
> pid = File.new(defaults[:pid_file]).readline
> 
> ```
> 
> - 
> 
> ```
> running = Process.kill(0, pid.to_i) rescue nil
> 
> ```
> 
> - 
> 
> ```
> if running
> 
> ```
> 
> - 
> 
> ```
> log "!!! PID file #{defaults[:pid_file]} already exists 
> 
> ```
> 
> and the p$
> 
> - 
> 
> ```
> exit 1
> 
> ```
> 
> - 
> 
> ```
> else
> 
> ```
> 
> - 
> 
> ```
> log "!!! PID file #{defaults[:pid_file]} exists, but is 
> 
> ```
> 
> stale, an$
> 
> - 
> 
> ```
> File.delete(defaults[:pid_file])
> 
> ```
> 
> - 
> 
> ```
> end
> end
> 
> daemonize
> 
> ```
> 
> * * *
> 
> Apply it in mongrel directory (probably  
> /usr/lib/ruby/gems/1.8/gems/mongrel-x.x.x/) by:  
> patch -p0 \< /path/to/mongrel\_stale\_pid\_file.patch
> 
> I’m now going back troubleshooting my mongrel\_cluster autostart  
> problem!? If anyone has ideas:
> 
> I can say “/etc/init.d/mongrel\_cluster start” and it starts just fine,  
> but when I restart the system, it doesn’t start…
> 
> I did issue:  
> “sudo update-rc.d mongrel\_cluster defaults” and got:  
> Adding system startup for /etc/init.d/mongrel\_cluster …  
> /etc/rc0.d/K20mongrel\_cluster → …/init.d/mongrel\_cluster  
> /etc/rc1.d/K20mongrel\_cluster → …/init.d/mongrel\_cluster  
> /etc/rc6.d/K20mongrel\_cluster → …/init.d/mongrel\_cluster  
> /etc/rc2.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster  
> /etc/rc3.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster  
> /etc/rc4.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster  
> /etc/rc5.d/S20mongrel\_cluster → …/init.d/mongrel\_cluster
> 
> Strange, very strange!!  
> nginx is starting fine… I tried to remove / add nginx links with  
> update-rc.d and it still worked… but cluster just won’t start… What  
> could possibly be causing this?
> 
> David

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [September 1, 2007, 6:45pm UTC](https://www.ruby-forum.com/t/mongrel-complaining-pids-and-not-up-to-date/113289/4 "2007-09-01T18:45:08Z")

</div>

Thanks, I’ve got Parallels for my macbook now so will try this out on a  
virtual pc before I attempt it on my live box.

Agree with mongrel, don’t know why it keeps complaining, maybe binding  
it to the EDGE version of rails will clear it but not worrying me now.

Thanks for your help on the PID’s issue, by the way,

John.
