httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Nicholes" <BNICHO...@novell.com>
Subject Re: MAX STRING LEN
Date Mon, 16 Jul 2001 15:13:31 GMT
    To clarify this problem a little more, the Apache source code tends to use MAX_STRING_LEN
whenever it needs to define a string of unknown lengh.  After looking at several locations
where MAX_STRING_LEN is used, the actual length of the string may be unknown, but will certainly
not need 8k of stack space.  What makes this a problem is when multiple character strings
are defined within a single function all with a size of MAX_STRING_LEN and then that function
is called recursively.  On OS's like NetWare where the stack size is fixed length, this will
blow the stack rather quickly.  One instance of this that we found is in the function send_parsed_content()
where three variables are being declared with a size of MAX_STRING_LEN amounting to 24k. 
When a server-side include operation is performed, this function is called recusively through
the use of a sub-request thus chewing up 48k+.  Is it really necessary for these variables
to be 8k each and are there other places in the code where apache is defining variables of
8k size when something significantly less will do?  This same problem seems to also exist
in the Apache 2.0 code.  Are there other OS's that must depend on a fixed stack size or is
this just a NetWare problem?

Brad

>>> RJENSEN@novell.com Friday, July 13, 2001 2:18:32 PM >>>

Question regarding MAX_STRING_LEN
What is the reasoning behind the defining the max string len to 8k? 

/* The default string lengths */
#define MAX_STRING_LEN HUGE_STRING_LEN
#define HUGE_STRING_LEN 8192

And do we need to use it for the following:

char error_str[MAX_STRING_LEN];
char time_str[MAX_STRING_LEN];

NetWare does not automatically grow the stack size when needed.


Thanks Rich





Mime
View raw message