You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/03/12 12:52:39 UTC

DO NOT REPLY [Bug 27629] New: - Memory problem with GZIPOutputFilter

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27629>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27629

Memory problem with GZIPOutputFilter

           Summary: Memory problem with GZIPOutputFilter
           Product: Tomcat 5
           Version: 5.0.19
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Coyote
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: Christian.Nester@sap.com


Hi,

the Deflater object, that is used inside the GZIPStream uses native memory. 
This memory will only be free, when the Deflater's finializer runs. See also 
Sun's Bugparades. If the memory is not free, an OutOfMemoryError is created 
sooner or later.
In an enviroment with a lot of memory the java GC might be invoked too late. I 
was able to crash tomcat with a lot of memory and some test load in a few 
seconds.
The solution is to explizitly close the Deflater Objekt to free the native 
memory. This can be done by closing the GZIP stream.
My propose solution to fix the problem in GZIPOutputFilter is included below.
After that change, I was not able to reproduce the crash.
Please verify my solution.

Regards,
Christian


    public long end()
        throws IOException {
        if (compressionStream == null) {
            compressionStream = new GZIPOutputStream(fakeOutputStream);
        }
        compressionStream.finish();
	  long result = ((OutputFilter) buffer).end();
        compressionStream.close(); // frees the deflater memory!
        return result;
    }

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