首页 / 软件开发 / JAVA / Weblogic81中HttpCompleteMessageTimeout相关的两个异常
Weblogic81中HttpCompleteMessageTimeout相关的两个异常2011-01-08 BlogJava 走走停停又三年在网络性能较差的环境中,weblogic server的日志中经常能看到如下的两种异常,1:####<Mar 1, 2005 12:18:57 PM PST> <Error> <HTTP> <****> <****> <ExecuteThread: "3" for queue: "weblogic.kernel.System"> <<WLS Kernel>> <> <BEA-101083> <Connection failure. java.io.IOException: A complete message could not be read on socket: "weblogic.servlet.internal.MuxableSocketHTTP@115954e - idle timeout: "30000"ms, socket timeout: "100" ms", in the configured timeout period of "60" secs2:####<2008/11/14 09:18:23 PM PST> <Info> <HTTP> <****> <****> <ExecuteThread: "0" for queue: "weblogic.kernel.System"> <<anonymous>> <> <BEA-101326> <The server could not send the HTTP message during the configured timeout value. The socket has been closed.> 我们可以看到上面的两个异常都是因为在指定的timeout时间内完成数据包的发送。BEA-101083出现在客户端请求往服务器端发送请求数据的时间内没有结束,而BEA-101326则是发生在weblogic回写response的时候在指定的timeout内没有完成数据包发送。 HttpCompleteMessageTimeout默认值为60秒,最大值为480秒。如果没有设定,会取 server---->Protocols---->General中的CompleteMessageTimout值(general中配置适合于所有协议,包括Http, T3, IIOP等)。如果两个都没有设定,那么weblogic server会将该值设定为:CompleteMessageTimeoutTrigger. CLEANUP_TRIGGER_TIMEPERIOD_LOW=2secs。注意:CompleteMessageTimeout是数据包,而不是整个请求的timeout时间。对于BEA-101326,假如客户端请求下载一个100M的文件,这100M的文件将会被分解成N多TCP/IP packets进行传送(weblogic内部为chunk,默认的chunk大小为4080bytes,chunk的大小可以通过 -Dweblogic. ChunkSize设定)。100M的文件即使在网络性能很好的情况下,也很难在60秒(CompleteMessageTimout的默认值)内完成,所以这个timeout不是针对整个reponse而言的。在weblogic实现中,每次回写数据包(Chunk)的时候,会将当前的 OutputStream register到CompleteMessageTimeoutTrigger中,这样trigger被触发的时候,它会负责检查这个数据报是否在指定的timeout内完成发送,如果没有,则BEA-101326会记入到日志中,同时会关闭到客户端的socket,剩余的数据将无法继续写入。如果数据包在timeout之前已经写完,该OutputStream会从tigger中移除,tigger不会继续检查该OutputStream1 static void writeChunks(Chunk header,Chunk c, OutputStream os, int size, boolean chunkXfer) throws IOException {
2 try {
3 trigger.register(os);
4 if (chunkXfer)
5 writeChunkTransfer(header,c, os);
6 else
7 writeChunkNoTransfer(header, c, os, size);
8 } finally {
9 trigger.unregister(os);
10 }
11}