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=28731>.
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=28731

Memory leak triggered by clients breaking connections

           Summary: Memory leak triggered by clients breaking connections
           Product: Tomcat 5
           Version: 5.0.19
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Connector:AJP
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


After running under heavy load for awhile our web application crashes because of
OutOfMemoryErrors. Some research revealed that there is a memory leak in Tomcat
caused by clients closing connections prematurely. I.e., when browsers issue
requests to Apache/Tomcat and do not read the response completely before closing
their sockets, the Tomcat process grows indefinitely. Because the problem is
triggered by the same situation the bug might be related to bug #27534. However,
while 27534 seems to be a JK2 only bug this bug also occurs with JK1. But since
I cannot reproduce this problem using Tomcat's HTTP Connector (i.e., running
without Apache) it still seems to be related to the JK connector.

Here is how to reproduce the problem. Install the attached JSP in some web
application. Modify the attached TestClient to connect to that application, i.e.
adapt the HOST, PORT and DOCUMENT constant to your setup. Run the TestClient and
monitor Tomcat's size (or wait until it crashed with OutOfMemoryErrors).

The TestClient requests the JSP and extracts the request's URL including the
session ID from the first response. Then it requests the JSP again and again
using this session ID. I.e, all requests by TestClient belong to a single
session to avoid allocating more and more memory for new sessions.

When TestClient is modified to read Tomcat's responses completely (see comments)
everything is fine and the Tomcat process soon reaches a more or less constant
size. However, when TestClient closes the connections prematurely without fully
reading the responses, the Tomcat process will grow indefinitely until it is
relieved by OutOfMemoryErrors.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to