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/09 10:12:59 UTC

DO NOT REPLY [Bug 27534] New: - Servlet invoked twice with JK2 when response is not read completely.

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

Servlet invoked twice with JK2 when response is not read completely.

           Summary: Servlet invoked twice with JK2 when response is not read
                    completely.
           Product: Tomcat 5
           Version: 5.0.19
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Native:JK
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: stefan.proels@gmx.de


When a connection to Apache/mod_jk2 is closed before a response exceeding a
certain size has been read completely, the request is processed twice. The bug
is present in JK2 only (2.0.2 distribution)-- JK1 works fine. With JK2, however,
a browser breaking a connection before the response has been read completely may
cause a servlet to be invoked twice. This may lead to severe problems when, for
instance, the servlet writes something to a database twice. The problem can be
reproduced with IE when clicking a second link before the preceeding request has
finished, but this requires the responses to exceed of a certain size and a
correct timing of the second click. The attached test program simulated this
situation and allows the bug to be reproduced quite reliably. Install the JSP in
some web application, adjust TestClient.java to use the approbiate port and URL
and start it. TestClient simply invokes the JSP again and again, passing an id
which is incremented on every request to it. The JSP reads this id and prints it
to System.out, i.e., catalina.out. As the id is incremented with every call no
duplicate ids should be written by the JSP. This works fine as long as the JSPs
responses are read completely by the client. TestClient, however, closes every
third connection prematurely and this causes the JSP with JK2 to output
duplicate ids. I.e., the JSP is invoked twice when the connection is closed
prematurely. You can easily modify TestClient to break every n-th connection and
watch the JSP to be invoked twice every n-th request. You can verify that the
TestClient did not resubmit the request using the Apache logs. In most cases the
second invocation of the servlet/JSP occurs immediately after the first.
However, this is not always the case. Randomly the second invocation will occur
after the next request has already been process successfully.

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