日期:2014-05-17  浏览次数:20898 次

Tomcat与apache2集群的问题

?

最近在Tomcat与apache2集群的问题的应用程序中,

有一个文件下载的功能。在连续多次点击下载,然后再打开的下载对话框点击【取消】之后。出现服务器无法访问503的错误。

?

错误日志:

catalina.out:
 Exception thrown whilst processing POSTed parameters
 java.io.IOException
 at org.apache.jk.common.JkInputStream.receive(JkInputStream.java:205)
 at org.apache.jk.common.JkInputStream.doRead(JkInputStream.java:179)
 at org.apache.coyote.Request.doRead(Request.java:419)
 at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:264)
 at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:403)
 at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:279)
 at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:193)

?

?

最后在tomcat的邮件列表里面找到的原因:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200911.mbox/%3Chen6qc$3rg$1@ger.gmane.org%3E

?

"ArthIT" <arthur.hupka@innovations.de> wrote in message 
news:26531167.post@talk.nabble.com...
>
> Hi,
>
> we are facing some weird problems at one of our customers.
> Our application is running on a tomcat server behind a Apache2 Webserver
> which does SSL.
> The servers are connected with mod_proxy_ajp.
> The network is a slow 2MBit WAN which is used to capacity.
>
> Within this infrastructure we periodically get Broken Pipe Exceptions 
> which
> are caused by an IOException in JKInputStream.
>
> Conspicuous is the following: When an IOException occurs in most of the
> cases (not in all) it is followed by another one, exactly 30seconds later.
> I think Apache tries to resend the request to tomcat after a timout is
> reached.
>
> The IOExceptions in JKInputStream are thrown on AjaxRequests only 
> (realised
> with wicktes AjaxFormSubmittingBehavior), which are done on every "onblur"
> javascript event. Our app contains pretty complex forms, with many input
> fields (>200). If one is tabbing fast through the form many ajax events 
> are
> fired...
>
> I tried to reproduce this at our companies network with FireFox Network
> throttling plugin (500Byte/s up and download), without luck.
>
> Note:
> The customer uses IE6 and IE7.
> This problem arises at the special WAN Network only. Our customer has
> another internal production system (same application) at a LAN network,
> which does not face these Exceptions.
>
>
> Does anybody has a hint or idea what could be going on? That would be 
> great!
> Many thanks in advance to everybody who investigates on this.
>

The first Exception below is harmless, since it is just Tomcat trying to 
tell Apache that it is ready for the next request, but Apache has stopped 
listening.  It just results in the Thread going back to the pool.  The 
second Exception below is from Tomcat requesting the POST body from Apache, 
but not getting it.

My best guess is that Apache is timing out when trying to read the request 
body from the WAN.  It then tells mod_proxy_ajp that it couldn't get the 
data it wants.  Then mod_proxy_ajp thinks that the client has gone away, so 
signals this to Tomcat by closing the connection.  This results in the 
second Exception below when Tomcat is trying to read from a closed 
connection.

The Apache logs would be the place to look for more information.

> See bellow the stack traces:
>
> catalina.out:
> 20.11.2009 10:22:29 org.apache.jk.core.MsgContext action
> WARNUNG: Error sending end packet
> java.net.SocketException: Broken pipe
> at java.net.SocketOutputStream.socketWrite0(Native Method)
> at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
> at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
> at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:537)
> at