Bug 16046 - Memory leak
Summary: Memory leak
Status: CLOSED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_deflate (show other bugs)
Version: 2.0.43
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-14 01:20 UTC by Dmitri Dmitrienko
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Dmitrienko 2003-01-14 01:20:28 UTC
Memory leak ~ 8k occurs every time I run PROPFIND webdav method when 
mod_deflate is activated, e.g. if client issued Accept-Encode: gzip header.
PROPFIND was used against a quite big directory (~400files) and the responce 
stream was ~ 400kB (after de-compression).
Problem does not appear if either mod_deflate is not loaded or if "Accept-
Encode: gzip" is not used.

Following configuration directives are in my httpd.conf:

#stripped off common top
LoadModule deflate_module modules/mod_deflate.so
NameVirtualHost localhost:80
NameVirtualHost localhost:801
<VirtualHost localhost:80>
</VirtualHost>
<VirtualHost localhost:801>

DAVLockDB logs/DavLock
<Directory "D:/apa2_0_43/htdocs">
    SetInputFilter DEFLATE
    SetOutputFilter DEFLATE
    DAV On
    <Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
        AuthName             "Fx"
        AuthType             Basic
        AuthUserFile         logs/passw
        Require user dmitri
    </Limit>
</Directory>
</VirtualHost>
Comment 1 Jeff Trawick 2003-01-15 16:54:31 UTC
A memory leak was fixed after 2.0.43.  Please download the latest mod_deflate
(from http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/filters/mod_deflate.c)
or wait for 2.0.44, then report back.

Thanks!
Comment 2 Dmitri Dmitrienko 2003-01-15 20:00:45 UTC
I've checked.
Yes indeed the bug went away.

But please don't close it immediately. By learning sources I see that there 
are some conditions when some additional leaks may occur again.
mod_deflate does not always make a paired call to inflateEnd() after 
inflateInit2() was called. It make a big concern that the leak can be 
reproduced with for example a trimmed compressed part.
Remember that after inflateInit2() was called zlib may allocate up to 
256kb of memory and releases all in inflateEnd() only.
Comment 3 Dmitri Dmitrienko 2003-01-15 20:55:02 UTC
I checked with a "trimmed" (e.g. wrong) compressed request.
As expected Apache gets HTTP/1.1 400. But as predicted a memory leak occurs 
too. Approx. 48kB for a request.

Conditions: mod_deflate mod_dav mod_dav_fs installed.
PROPFIND request made with Content-encoding: gzip and content is too short 
(trimmed) for example just 11 bytes. Gzipped content can never be less than 18 
bytes:

#####Headers:

PROPFIND / HTTP/1.1
Content-Encoding: gzip
Content-Type: text/xml; charset="utf-8"
Content-Length: 11
Host: localhost:801
Accept: text/html, */*
Accept-Encoding: gzip
User-Agent: Mozilla/3.0 (compatible; DD Library)
Depth: 1

#####Content - gzipped but trimmed, hex dump
0x1F 0x8B 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x0B 0xB3 


My investigation showed that a call to inflateEnd() is missed. Occurs when 
conditions above are met.
Comment 4 Justin Erenkrantz 2003-02-17 04:49:04 UTC
Should be fixed in modules/filters/mod_deflate.c r1.30

Thanks for using Apache HTTP Server!