Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

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

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.

PLEASE HELP!!!

0
sbweitzman
Asked:
sbweitzman
  • 3
1 Solution
 
sbweitzmanAuthor Commented:
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?

Stu
0
 
sbweitzmanAuthor Commented:
Is anybody out there?
0
 
sbweitzmanAuthor Commented:
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/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

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
URLs.

Stu





0
 
EE_AutoDeleterCommented:
sbweitzman,
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.

EE_AutoDeleter
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now