Mongrel failing to start on bootup as PID files still exist


#1

Hi,
One of my site’s servers had a problem yesterday and the host
restarted it. During boot up Mongrel failed to start as the PID files
still existed in /log

I didn’t find out about this reboot until several hours later so the
site was down that entire time which is less than ideal.

Does anybody know of a way around this? Is there a built in way to
force Mongrel to start and overwrite any existing PID files?

I have the mongrel_cluster startup script setup correctly btw.

Thanks in advance.

Regards,

Niall M.


#2

You could write init.d script to check if those files exist and if so
delete them before trying to start up the cluster.

  • Richard

#3

Thanks Richard, was thinking of doing that but was wondering if there
was an existing solution, one built into Mongrel perhaps.

Niall M.

removed_email_address@domain.invalid wrote:

I didn’t find out about this reboot until several hours later so the

Niall M.


Niall M.
4L Communications Ltd.
http://www.4L.ie/


#4

I have the mongrel_cluster startup script setup correctly btw.
I usually write some shell script to clear out the pid files, but
another way that works is to have mongrel put it’s pid files in the /tmp
directory which gets emptied on restart.


Daniel J.
Systems Administrator

PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting


http://teknot.us [blog]
teknotus [freenode IRC]
+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]


#5

or do it with --clean to mongrel_cluster?

Vish


#6

Hi:

Install the mongrel_cluster prerelease (soon to be released after I
recover from RailsConf) and change your pidfile location to /var/run/
mongrel_cluster (on linux). Be sure to copy the new init.d script out
of the gem source.

http://blog.railsmachine.com/2007/2/26/mongrel_cluster-prerelease-1-0-1-1

Bradley


#7

Thanks for that Jim, will definitely look into both options.

And thanks for the other responses as well.

Niall

removed_email_address@domain.invalid wrote:

Hello Niall – it looks like you have plenty of options for clearing
satisfied user.

Jim


Niall M.
4L Communications Ltd.
http://www.4L.ie/


#8

Niall M. wrote:

Hi,
One of my site’s servers had a problem yesterday and the host
restarted it. During boot up Mongrel failed to start as the PID files
still existed in /log

I didn’t find out about this reboot until several hours later so the
site was down that entire time which is less than ideal.

Does anybody know of a way around this? Is there a built in way to
force Mongrel to start and overwrite any existing PID files?

I have the mongrel_cluster startup script setup correctly btw.

Thanks in advance.

Regards,

Niall M.

On a related note.
A script like this will kill any mongrel instance that is hanging around
after its pid file is gone.
#!/usr/local/bin/ruby

3000 is the port you wish to kill.

pid = lsof -i :3000.split("\n")[1].split()[1] rescue nil
%x{kill -9 #{pid}} unless pid.nil?


#9

Yeah look at this: http://textsnippets.com/posts/show/931

Works a treat!

----- Original Message -----
From: “David H.” removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Sent: Wednesday, June 20, 2007 2:21 PM
Subject: [Rails-deploy] Re: Mongrel failing to start on bootup as PID
files
still ex


#10

On May 21, 5:46 am, Niall M. removed_email_address@domain.invalid wrote:

Hi,
One of my site’s servers had a problem yesterday and the host
restarted it. During boot up Mongrel failed to start as the PID files
still existed in /log

I didn’t find out about this reboot until several hours later so the
site was down that entire time which is less than ideal.
Hello Niall – it looks like you have plenty of options for clearing
out those pesky PID files, but no one has addressed this part of your
email. Anything beyond a hobby site needs some sort of monitoring for
situations just like this. At RailsConf, Ezra specifically mentioned
using monit (which I currently use) to monitor one’s individual
mongrel processes. If that sounds like too much work, an excellent
alternative is the free Heartbeat website (http://
heartbeat.highgroove.com/) which allows you to monitor multiple
application URLs and email yourself when things go awry. I’d
encourage you to go sign up for heartbeat and see if using monit is
feasible for you. No financial connection to either one, just a very
satisfied user.

Jim