tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cmanola...@yahoo.com>
Subject Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp13_worker.c
Date Thu, 11 Nov 2004 17:27:39 GMT
Mladen Turk wrote:
> jean-frederic clere wrote:
> 
>> Mladen Turk wrote:
>>
>>> Costin Manolache wrote:
>>>
>>>> Are you joking :-) ?
>>>
>>>
>>> If we can not alloc couple of bytes from the system, then the
>>> entire system is unstable.
>>
>>
>> Or that the process that makes the malloc() has reached a configurable 
>> limit of the amount of memory it is allowed to use.
>>
> 
> 
> Sure, but the system is still unusable.
> 
> This checking is done inside worker_factory, called from init_jk,
> so IMHO the apache will fail long before.
> 
> But if everyone thinks it's a good to check for failed memory
> allocation on small objects, I'll revert the patch.
> 

Well, I see your point - probably it doesn't matter much, I'm sure other 
places in code will not check and it would crash anyway. Most OSes use 
swap, so the system will trash and become unuseable before running out 
of memory. But there are other cases where the swap is not used - and 
then malloc failure is a common condition under load.

If the system is very loaded, it is possible you'll run low on memory 
and you don't know which malloc will fail - maybe the small one. The 
correct behavior would be to give up and return a 500 on the request ( 
that may go through since apache probably already have the memory 
allocated in the memory pools ). On single process/multithread systesm, 
an apache server crashing under load is not a good thing :-)

IMO all mallocs should be checked - but probably I spend too much time 
with systems with very little memory where a crash is not such a good 
thing :-)

Costin
Costin







---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message