You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Silvio Lopes de Oliveira <sl...@shuf.com> on 2002/01/09 00:16:28 UTC

Memory limit for CGI processes?

Hi all,

I am writing a series of CGI programs that must run on both MS IIS and
Apache on Linux. Although they work perfectly on IIS, many of them are
stalling on Linux--I get a "Page cannot be displayed error" on Internet
Explorer, but no errors are reported in the Apache log.. I ran the
experiment below and now I'm inclined to believe my problem is related to
how much memory my CGI process is allowed to use.

I have a loop that allocates a certain number of bytes of memory each time
it is executed, which get deallocated later on in the program. As long as I
make it loop 4 times or less, the program executes correctly--a greater
number of loops will cause the error described. However, if cut the bytes
allocated in half, I can set the loop to 9 repetitions, and if cut it in
half again I can set it to loop19 times without error.

This behavior of being able to roughly double the number of loops each time
I cut the allocated memory in half makes me inclined to believe Apache (or
maybe Linux?) sets a cap on the memory my CGI process can use. Does anyone
know anything on this subject? I know very little about web servers, so any
help is appreciated.

Thanks,
Silvio




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Memory limit for CGI processes?

Posted by Randy Coleman DTI <ra...@dti-web.com>.
Hi
It is possible. Are you using a 'wrapper' or 'sbox' on your cgi-bin for 
security?
Randy

At 1/8/02 05:26 PM -0600, you wrote:
>What language are you using, where you have to think about memory allocation?
>
>On Tuesday, January 8, 2002, at 05:16 PM, Silvio Lopes de Oliveira wrote:
>
>>Hi all,
>>
>>I am writing a series of CGI programs that must run on both MS IIS and
>>Apache on Linux. Although they work perfectly on IIS, many of them are
>>stalling on Linux--I get a "Page cannot be displayed error" on Internet
>>Explorer, but no errors are reported in the Apache log.. I ran the
>>experiment below and now I'm inclined to believe my problem is related to
>>how much memory my CGI process is allowed to use.
>>
>>I have a loop that allocates a certain number of bytes of memory each time
>>it is executed, which get deallocated later on in the program. As long as I
>>make it loop 4 times or less, the program executes correctly--a greater
>>number of loops will cause the error described. However, if cut the bytes
>>allocated in half, I can set the loop to 9 repetitions, and if cut it in
>>half again I can set it to loop19 times without error.
>>
>>This behavior of being able to roughly double the number of loops each time
>>I cut the allocated memory in half makes me inclined to believe Apache (or
>>maybe Linux?) sets a cap on the memory my CGI process can use. Does anyone
>>know anything on this subject? I know very little about web servers, so any
>>help is appreciated.
>>
>>Thanks,
>>Silvio
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>The official User-To-User support forum of the Apache HTTP Server Project.
>>See <URL:http://httpd.apache.org/userslist.html> for more info.
>>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Memory limit for CGI processes?

Posted by ca...@spcmg.com.
Using gcc on Linux I suppose? You say a list, so something like an STL 
vector? Is the program being run by apache, or indirectly by spawn/exec  
activity. Could be the way the C++ program is terminating. I think I 
would make it a stand-alone app. or check the exit method; if it's a 
memory leak in C++, then my first inclination is that garbage collection 
wasn't done on exit.

Honestly, unless there is some real compelling reason, it would be much 
safer to use PHP, JSP/Servlet, Perl, Python, or some other scripting 
language, which would handle the memory allocations in a platform-safe 
way.  Just my suggestion.

On Tuesday, January 8, 2002, at 05:32 PM, Silvio Lopes de Oliveira wrote:

> The program is written in C++. During each loop, I read a single line 
> from a
> text file, which is stored in a dynamically allocated array of 
> characters
> and then added to a linked list.
>
> ----- Original Message -----
> From: <ca...@spcmg.com>
> To: <us...@httpd.apache.org>
> Sent: Tuesday, January 08, 2002 3:26 PM
> Subject: Re: Memory limit for CGI processes?
>
>
>> What language are you using, where you have to think about memory
>> allocation?
>>
>> On Tuesday, January 8, 2002, at 05:16 PM, Silvio Lopes de Oliveira 
>> wrote:
>>
>>> Hi all,
>>>
>>> I am writing a series of CGI programs that must run on both MS IIS and
>>> Apache on Linux. Although they work perfectly on IIS, many of them are
>>> stalling on Linux--I get a "Page cannot be displayed error" on 
>>> Internet
>>> Explorer, but no errors are reported in the Apache log.. I ran the
>>> experiment below and now I'm inclined to believe my problem is related
>>> to
>>> how much memory my CGI process is allowed to use.
>>>
>>> I have a loop that allocates a certain number of bytes of memory each
>>> time
>>> it is executed, which get deallocated later on in the program. As long
>>> as I
>>> make it loop 4 times or less, the program executes correctly--a 
>>> greater
>>> number of loops will cause the error described. However, if cut the
>>> bytes
>>> allocated in half, I can set the loop to 9 repetitions, and if cut it 
>>> in
>>> half again I can set it to loop19 times without error.
>>>
>>> This behavior of being able to roughly double the number of loops each
>>> time
>>> I cut the allocated memory in half makes me inclined to believe Apache
>>> (or
>>> maybe Linux?) sets a cap on the memory my CGI process can use. Does
>>> anyone
>>> know anything on this subject? I know very little about web servers, 
>>> so
>>> any
>>> help is appreciated.
>>>
>>> Thanks,
>>> Silvio
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server
>>> Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server 
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Memory limit for CGI processes?

Posted by Silvio Lopes de Oliveira <sl...@shuf.com>.
The program is written in C++. During each loop, I read a single line from a
text file, which is stored in a dynamically allocated array of characters
and then added to a linked list.

----- Original Message -----
From: <ca...@spcmg.com>
To: <us...@httpd.apache.org>
Sent: Tuesday, January 08, 2002 3:26 PM
Subject: Re: Memory limit for CGI processes?


> What language are you using, where you have to think about memory
> allocation?
>
> On Tuesday, January 8, 2002, at 05:16 PM, Silvio Lopes de Oliveira wrote:
>
> > Hi all,
> >
> > I am writing a series of CGI programs that must run on both MS IIS and
> > Apache on Linux. Although they work perfectly on IIS, many of them are
> > stalling on Linux--I get a "Page cannot be displayed error" on Internet
> > Explorer, but no errors are reported in the Apache log.. I ran the
> > experiment below and now I'm inclined to believe my problem is related
> > to
> > how much memory my CGI process is allowed to use.
> >
> > I have a loop that allocates a certain number of bytes of memory each
> > time
> > it is executed, which get deallocated later on in the program. As long
> > as I
> > make it loop 4 times or less, the program executes correctly--a greater
> > number of loops will cause the error described. However, if cut the
> > bytes
> > allocated in half, I can set the loop to 9 repetitions, and if cut it in
> > half again I can set it to loop19 times without error.
> >
> > This behavior of being able to roughly double the number of loops each
> > time
> > I cut the allocated memory in half makes me inclined to believe Apache
> > (or
> > maybe Linux?) sets a cap on the memory my CGI process can use. Does
> > anyone
> > know anything on this subject? I know very little about web servers, so
> > any
> > help is appreciated.
> >
> > Thanks,
> > Silvio
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> > Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Memory limit for CGI processes?

Posted by ca...@spcmg.com.
What language are you using, where you have to think about memory 
allocation?

On Tuesday, January 8, 2002, at 05:16 PM, Silvio Lopes de Oliveira wrote:

> Hi all,
>
> I am writing a series of CGI programs that must run on both MS IIS and
> Apache on Linux. Although they work perfectly on IIS, many of them are
> stalling on Linux--I get a "Page cannot be displayed error" on Internet
> Explorer, but no errors are reported in the Apache log.. I ran the
> experiment below and now I'm inclined to believe my problem is related 
> to
> how much memory my CGI process is allowed to use.
>
> I have a loop that allocates a certain number of bytes of memory each 
> time
> it is executed, which get deallocated later on in the program. As long 
> as I
> make it loop 4 times or less, the program executes correctly--a greater
> number of loops will cause the error described. However, if cut the 
> bytes
> allocated in half, I can set the loop to 9 repetitions, and if cut it in
> half again I can set it to loop19 times without error.
>
> This behavior of being able to roughly double the number of loops each 
> time
> I cut the allocated memory in half makes me inclined to believe Apache 
> (or
> maybe Linux?) sets a cap on the memory my CGI process can use. Does 
> anyone
> know anything on this subject? I know very little about web servers, so 
> any
> help is appreciated.
>
> Thanks,
> Silvio
>
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org