httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "greg boyington" <>
Subject [users@httpd] debugging strategies for httpd that kills the box
Date Thu, 15 Nov 2007 17:20:44 GMT
Hello List,

I have a FreeBSD 5.5 (amd64) server with the following:

Apache/2.0.61 (FreeBSD)
PHP/4.4.4 with Suhosin-Patch

Background:  The server was recently updated to FreeBSD 5.5 from 5.3,
which had run for a couple of years without interruption.  I'm not
especially convinced the issue I'm having is related to this upgrade,
but it's the most significant change in some time, so it's worth
mentioning.  Apache is configured with KeepAlive on, as this box
provides a number of other services, but I noticed last week that the
majority of the requests (specifically those being handled by
HTML::Mason via mod_perl) were not sending a Content-Length header,
and thus the KeepAlive settings were largely useless.  I added this
header to the mod_perl output, and began tuning apache to maximize
performance.  I got, for us, quite acceptable results using the

<IfModule prefork.c>
StartServers           5
MinSpareServers        5
MaxSpareServers       10
MaxClients           200
MaxRequestsPerChild    0

The problem: After a few days the server became unstable.  Twice the
server was out of swap space and had to be rebooted.  While attempting
to solve this problem, I came to understand that the webserver seemed
responsible; for as-yet unknown reason, the box will suddenly lock up,
and if I do not kill httpd within 5 or 10 seconds the server will
become completely unresponsive and need to be rebooted.  If left
alone, swap space will be consumed and the kernel will begin killing
off httpd processes, but not fast enough.  By altering the apache
config to the following, I am able to avoid the hang:

<IfModule prefork.c>
StartServers           5
MinSpareServers        5
MaxSpareServers        5
MaxClients            40
MaxRequestsPerChild    0

But naturally this provides less than optimal performance.  Other
things I tried, without impact:

-- setting KeepAlive off
-- disabling all vhosts
-- disabling mod_perl2
-- disabling mod_php
-- running httpd -X
-- tweaking/disabling resource limits via Apache2::Resource
-- recompiling httpd
-- recompiling mod_perl2
-- recompiling & reinstalling the freebsd userland

The server has 1gb of ram, 4gb of swap (I recently doubled it in an
attempt to give me more time to diagnose the problem when it occurs --
didn't help, as the lock-up occurs long before swap is consumed), and
in the moments before the hang, shows no particular level of activity
-- swap usage is around 100mb, load is very low (1.5 - 2.0 on a
dual-proc system).  There doesn't seem to be any correlation to
specific requests or request types, whether static, cgi, mod_perl or
php.  There are no errors in the server logs prior to the lock up (
although once, and only once, i saw "httpd in free(): error: page is
already free" ).

I'm hoping someone here can make some suggestions on how to
troubleshoot the problem further, because I'm kind of at a loss.

I have not (yet) posted this to the mod_perl list or freebsd-users,
though I would be happy to do so if it's thought the problem might lie
within those realms.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message