Getting a ClientAbort Exception (Connection reset by peer) to be recognized by Tomcat 5.5

Posted on 2006-05-17
Last Modified: 2008-01-09
Hi All,

Wierd thing happening within our server environment....  Here's the scenario:

I have an Apache server hooked up to Tomcat for serving JSP pages.

There is a servlet that grabs a file for downloading, and sends the actual FileStream down to the end user.

I am monitoring when the download starts, end, and whether or not the download is aborted.

The code works fine... HOWEVER, I think the Apache config is incorrect in sending messages to Tomcat.  Here's what happens:

A file gets requested by an end user.

The file starts downloading to the user.  I can see the bytes being written out to a log file (log4j style).

IF THE USER ABORTS the download, APache acknowledges the abort request, but Tomcat CONTINUES TO SEND THE FILE.  Tomcat is NOT receiving the termination request.


Question by:sbweitzman

    Author Comment

    Ok... so a ClientAbortException, when accessing Tomcat directly works fine, since this is Tomcat Specific.  I think I'm on the right path when I'm looking for a 206 error code (partial file download) on a specific file.

    Can I capture that somehow on Apache, and pass it over to Tomcat?  something in a config file that runs a page if a 206 is encountered?


    Author Comment

    Is anybody out there?

    Author Comment

    Since no one has responded, here's the answer:

    "Right, this is a problem, but I'm afraid it can't be resolved.
    The issue has been addressed as an extension to the AJP protocol, and until we extend the AJP protocol it won't be solvable.

    The solution would be to notify the Tomcat of the broken client connection without closing the actual connection between mod_jk and Apache. This can be done only by sending a dedicated AJP packet that would cause a IOException to be thrown in the Servlet.

    We have already discussed the AJP protocol enhancements on the tomcat-dev, and I presume it will be done this summer."

    Because this is a limitation in the protocol itself and not a bug in the connector or a problem in confguration, the best possibility is the use of the Apache proxy module to pass http requests directly to Tomcat.  

    The configuration now looks like this:

    LoadModule proxy_module modules/
    LoadModule proxy_connect_module modules/
    LoadModule proxy_ftp_module modules/
    LoadModule proxy_http_module modules/

    ProxyRequests Off
    ProxyPass /mywebapp http://localhost:8080/mywebapp
    ProxyPassReverse /mywebapp http://localhost:8080/mywebapp
    ProxyPreserveHost On

    Basically, we're just passing everything through apache to Tomcat for specific



    Accepted Solution

    Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now