Ruby Forum Rails deployment > apache processes occassionaly hanging under mod rails

Posted by Scott Kulik (kuliksco)
on 05.08.2008 04:11
Every couple hours I always get a few apache processes that for some
reason never quit properly.  When I get enough of them my apache no
longer responds to any web requests and I need to restart it.  It looks
something like this (notice the times for the first 3 apache processes):

www-data 19283 16243  0 18:24 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19426 16243  0 18:32 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19437 16243  0 20:31 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19460 16243  0 21:49 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19470 16243  0 21:52 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19483 16243  0 21:54 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19487 16243  0 21:54 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19489 16243  0 21:54 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19493 16243  0 21:54 ?        00:00:00 /usr/sbin/apache2 -k
start
www-data 19501 16243  0 21:55 ?        00:00:00 /usr/sbin/apache2 -k
start

I have killed all of them currently that haven't been spawned in the
past 15 minutes but I think they are stuck at sending response...last
time i checked under http://localhost/server-status

the only message in my apache error logs are occasionaly:

[Mon Aug 04 21:25:13 2008] [info] server seems busy, (you may need to
increase StartServers, or Min/MaxSpareServers), spawning 8 children,
there are 4 idle, and 21 total children
[Mon Aug 04 22:05:28 2008] [info] server seems busy, (you may need to
increase StartServers, or Min/MaxSpareServers), spawning 8 children,
there are 3 idle, and 19 total children

which I have just upped my server settings (i dont think the stalled
processes are related to those error message though):

Timeout 120
MaxKeepAliveRequests 200
KeepAliveTimeout 3

<IfModule mpm_prefork_module>
    StartServers          50
    MinSpareServers       10
    MaxSpareServers       20
    MaxClients           256
    MaxRequestsPerChild 4000
</IfModule>

is there any way to find out what the apache processes are stalled on?
I think it might be related to some of my new code because it just
started happening recently but I can't reproduce it on demand.

i'm running ubuntu hardy 8.04.  thanks!
Posted by Aníbal Rojas (Guest)
on 07.08.2008 15:54
(Received via mailing list)
Scott,

    It is only recently that I have been playing with mod_rails, I
haven't see such behavior yet.

    Did the Rails log shows anything that could be associated to the
problem?

--
Aníbal Rojas
http://hasmanydevelopers.com
http://rubycorner.com
http://anibal.rojas.com.ve

On Aug 5, 9:11 pm, Scott Kulik <ruby-forum-incom...@andreas-s.net>
Posted by Scott Kulik (kuliksco)
on 08.08.2008 03:49
Aníbal Rojas wrote:
> Scott,
> 
>     It is only recently that I have been playing with mod_rails, I
> haven't see such behavior yet.
> 
>     Did the Rails log shows anything that could be associated to the
> problem?
> 
> --
> An�bal Rojas
> http://hasmanydevelopers.com
> http://rubycorner.com
> http://anibal.rojas.com.ve
> 
> On Aug 5, 9:11�pm, Scott Kulik <ruby-forum-incom...@andreas-s.net>

there were no errors until after i killed the processes...then i could 
see which page received a sigterm before it finished loading...but i 
could not reproduce the result.  it seemed to happen randomly.

i just switched to nginx + thin server last night and everything is 
working great so far...and using less memory!

i think it may be a bug in mod_rails.
Posted by Aníbal Rojas (Guest)
on 08.08.2008 12:51
(Received via mailing list)
I only use Apache when some of its mods or PHP is required. Otherwise
I stick to your mix: Nginx + Thin, it is a much lighter and simple
solution. Anyway it would be interesting gathering more information
regarding your problem as mod_rails looks promising.

---
Anibal

On Aug 8, 8:49 pm, Scott Kulik <ruby-forum-incom...@andreas-s.net>