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

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.

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

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

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

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

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.