httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14321] New: - memory leak in mod_deflate with dynamic content on Windows
Date Wed, 06 Nov 2002 23:54:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14321>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14321

memory leak in mod_deflate with dynamic content on Windows

           Summary: memory leak in mod_deflate with dynamic content on
                    Windows
           Product: Apache httpd-2.0
           Version: 2.0.43
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: mod_deflate
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: kfranken@decisionmark.com


mod_deflate shows substantial memory leakage when used with dynamic content, at
least on WindowsXP. Below is a test module to generate some dynamic content and
a section of the httpd.conf file I used.

The URL http://localhost/compressed-dynamic leaks about 8k per request over the
course of 20,000 requests using ab.exe; http://localhost/compressed-static and
http://localhost/uncompressed-* did not show any leaks. The leak_test.html file
used for the -static tests is just a saved version of one of the dynamic files.


httpd.conf
### Leak testing
Alias /leak_test "E:/Apache2/leak_test"
Alias /uncompressed-static "E:/Apache2/leak_test/leak_test.html"
Alias /compressed-static "E:/Apache2/leak_test/leak_test.html"

<Directory "E:/Apache2/leak_test">
	Order deny,allow
	Allow from all
</Directory>

<LocationMatch "^/compressed-">
	SetOutputFilter DEFLATE
	Order deny,allow
	Allow from all
</LocationMatch>
<LocationMatch "^/[a-z]+-dynamic">
	SetHandler leak-test
	Order deny,allow
	Allow from all
</LocationMatch>

mod_leak_test.c
/* mod_leak_test */
/* An example Apache 2.0 module that generates dynamic content that can be used
to */
/* test/demonstrate mod_deflate memory leakage */
/* 11/6/02 Ken Franken */

#include "ap_config.h"
#include "http_protocol.h"
#include "http_config.h"

#include <math.h>

module AP_MODULE_DECLARE_DATA leak_test_module;

static int leak_test_handler(request_rec *r)
{
	long i;

	/* if we aren't registered as a handler for the document, punt */
    if(strcmp(r->handler, "leak-test") != 0)
        return DECLINED;

    ap_set_content_type(r, "text/html");
	r->status = HTTP_OK;

    if (r->header_only) {
		return OK;
	}
	/* write some random data to the client */
	ap_rputs(DOCTYPE_HTML_4_0S, r); 
	ap_rputs("<html><body>", r); 
	for(i=0; i<1000; i++) 
		ap_rprintf(r, "%d%d%d<br>\n", rand(), rand(), rand());
	ap_rputs("</body></html>", r);

	return OK;
}

static void register_hooks(apr_pool_t *p)
{
    ap_hook_handler(leak_test_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA leak_test_module =
{
    STANDARD20_MODULE_STUFF,
    NULL,                        /* dir config creater */
    NULL,                        /* dir merger --- default is to override */
    NULL,                        /* server config */
    NULL,                        /* merge server config */
    NULL,                        /* command apr_table_t */
    register_hooks               /* register hooks */
};

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message