tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Svante Kumlien <>
Subject Multipart over ajp btwn apache-tomcat fails sometimes...
Date Fri, 13 Apr 2012 09:16:55 GMT
Hi all,

My stuff:
Windows Server 2008 R2 64 bit
Apache 2.2.22 with mod_proxy_ajp
Tomcat 7.0.25 (On same server as Apache)

I have an Apache acting as reverse proxy for a Tomcat over ajp.
Apache conf for the proxyPass:
<Location /tomcatSite>
ProxyPass ajp://
ProxyPassReverse ajp://

and the tomcat-config is really basic with nothing added to the default

The webapp listening on /tomcatSite is a servlet-2.5 app and it works
nicely for all types of request except when it comes to multi-part. We have
a java-client uploading .zip-files every night to this webapp and sometimes
it works and sometimes it fails. When testing we trigger the file upload
manually using the same zip file every time with the same result: sometimes
it works, and sometimes it fails.

What happens when it works:
Client sends multipart http-request to Apache.
Apache proxy to Tomcat over AJP
Servlet is called on doPost
Servlet uses apache-commons-fileupload 1.2 to parse the request
Servlet does something with the file
Servlet returns (200 OK)

What happens when it doesn't work:
Client sends http-requst
Apache proxy request
Servlet is called on doPost
Servlet uses apache-commons-fileupload
Commons-fileupload throws an Exception with message "Stream closed"
(Gaahhh, the stack trace is swallowed, I only have the message string! The
exception is thrown from  FileUploadBase.parseRequest :-( )
Servlet sends an email to admin
Servlet returns 200 OK

The behaviour seem random but I would say that it fails 80% using the same
file, same server, no restart.

I attach two pcap-files with a ok-case and a fail-case. The difference I
can see is that in the fail-case tomcat starts to send the response before
the first Body chunk is sent by Apache. In the ok-case the first Body-chunk
is sent by Apache the same millisecond as the first Request packet but in
the failing case the first Body chunk is sent a couple of millis after the
first packet somehow allowing Tomcat/my servlet to fail before the complete
request is received.

If we switch the proxyPass to use http everything works 100% of the time
(which makes me think I have a misconfig AJP connector somewhere...).

Any ideas/pointers are more than welcome!


View raw message