Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 151410 - Using apache directive AddDirectoryIndex in .htaccess file can cause excessive memory and CPU usage
Summary: Using apache directive AddDirectoryIndex in .htaccess file can cause excessiv...
Status: RESOLVED DUPLICATE of bug 139451
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Other
: High major (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-14 21:13 UTC by Joshua Pettett
Modified: 2007-04-04 07:01 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Pettett 2006-10-14 21:13:05 UTC
Placing an AddDirectoryIndex directive in an .htaccess file (assuming the appropriate AllowOverride setting of course), and then repeatedly attempting to access a web directory (through apache) that is without an index file and that said .htaccess file affects causes the apache child process to become bloated and consume an unacceptable amount of memory and CPU time.  I'm not really a C programmer, but I was able to dump out the new->index_names array within the merge_dir_configs() function in mod_dir.c and found the array to be continually and rapidly expanding with each request.  I assume that this is because the AddDirectoryIndex doesn't take into account that the .htaccess file is being repeatedly parsed, so it just keeps adding the same item to the DirectoryIndex list.  My experiments were done using the prefork MPM, but this bug may apply to others.

Steps to reproduce:
1. In web directory that does not have an index file (as defined by DirectoryIndex and AddDirectoryIndex), place the following .htaccess file (once again AllowOverride must be set to allow this):

AddDirectoryIndex foo.html

2. Repeatedly attempt to load the directory in a browser.  In my case, without Options Indexes and with a slow processor, a noticeable delay began to appear after about the 7th attempt .  With Options Indexes, the apache child process blew up immediately.  If you have to refresh the page several times before the problem becomes noticeable, make sure you do not hit refresh while the page is still "loading", otherwise a fresh child will be used to deliever the next request and you will have to start over again.


I know this report was a little hasty, please let me know if there's anything else you need, or anything I need to clarify.  I'd also be happy to provide more details how I attempted to diagnose this problem.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-10-15 00:35:56 UTC

*** This bug has been marked as a duplicate of 139451 ***
Comment 2 Joshua Pettett 2007-04-03 01:18:08 UTC
In a comment to bug #139451, I have proposed a solution, including a patch,  which fixes both of these bugs.  But I am unable to reopen that bug as I am not the original reporter.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-04-04 07:01:46 UTC

*** This bug has been marked as a duplicate of bug 139451 ***