CGI Push and Apache memory consumption
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: <users@xxxxxxxxxxxxxxxx>
- Subject: CGI Push and Apache memory consumption
- From: "Kiss, John (GE Infra, Energy, Non-GE)" <john.kiss@xxxxxx>
- Date: Fri, 11 Jan 2008 21:48:02 +0100
- Reply-to: users@xxxxxxxxxxxxxxxx
- Thread-index: AchUk0IqMwV55fIsR0Wl+lMh/YcJ0g==
- Thread-topic: CGI Push and Apache memory consumption
Hello I'm having an issue
with long running CGI push scripts causing Apache to consume all available free
memory over a period of several days.
The scenario : System free
memory at 220 Megs, browser connects to cgi push script. Within 3 days system
free memory goes down and hovers at 5 megs but now other browsers cannot connect
because of a lack of system resources. Let the system run for two more
days and Apache kills/restarts it's threads and free memory returns to 220Megs
and other browser can connect to web pages again. Without ever resetting
Apache I let this cycle repeat over a 2 week period.
I've tested on a custom
Linux system running Apache 2.0.55 under Linux 2.6.13 and on Ubuntu Feisty
which uses Apache 2.2.3 (using default apache config). The same problem appears
on both. Nothing special with configuration and loading of
modules.
I have attached a simple
CGI script that replicates the issue (See below) where Apache's memory grows
linearly at a rate of ~19.6kB/min (typically in 4kB increments depending on your
Linux/MMU page size).. If anyone has any insight on why this is happening and
what I can do resolve it, I would very be much appreciated
it.
Cheers
John
----------------------------------------------------------------------------------------------------------
Steps to reproduce:
-------------------
1. Build CGI script (see below cgi
script)
2. Restart
Apache.
3. Point a browser
at the CGI script.
4. Monitor system free
memory using 'free' and apache processes using 'ps'. Over a period of 10 minutes
you'll witness free memory going down and apache thread memory going
up.
1. cgi
script:
------------------------
#include <time.h>
#include
<dirent.h>
#include <stdio.h>
#include
<stdlib.h>
#include <string.h>
#include
<sys/time.h>
#include <sys/stat.h>
#include
<sys/types.h>
#include <unistd.h>
/*
main.
*/
int
main(int argc, char *argv[])
{
runPlain();
}
/*
Run a text/plain test.
*/
int
runPlain()
{
int i,j;
printf("Content-type: text/plain; charset=us-ascii\n\n");
for (i=0; ; i++)
{
for (j=0; j<5;
j++)
{
printf("%d,%d: wakka wakka wakka wakka wakka wakka
wakka\n",i,j);
}
printf("\n");
usleep(5000);
}
}
[Index of Archives]
[Open SSH Users]
[Linux ACPI]
[Linux Kernel]
[Linux Laptop]
[Kernel Newbies]
[Security]
[Netfilter]
[Bugtraq]
[Squid]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]