Author: pero Date: Sat Aug 18 10:14:07 2007 New Revision: 567298 URL: http://svn.apache.org/viewvc?view=rev&rev=567298 Log: Fix some timeout regression bugs with 5.5.23 and the new advanced socket config.
Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationListener.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationThread.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java?view=diff&rev=567298&r1=567297&r2=567298 ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java Sat Aug 18 10:14:07 2007 @@ -102,7 +102,7 @@ private boolean soLingerOn = true; private int soLingerTime = 3; private int soTrafficClass = 0x04 | 0x08 | 0x010; - private int timeout = 3000; //3 seconds + private int timeout = -1; // Regression with older release, better set timeout at production env /** * Compress message data bytes Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java?view=diff&rev=567298&r1=567297&r2=567298 ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java Sat Aug 18 10:14:07 2007 @@ -94,7 +94,7 @@ private int rxBufSize = 25188; private int txBufSize = 43800; - private long timeout = 3000; + private int timeout = 30000; private boolean tcpNoDelay = true; private boolean soKeepAlive = false; private boolean ooBInline = true; @@ -221,7 +221,7 @@ /** * After failure make a resend */ - private boolean resend = false ; + private boolean resend = true ; // ------------------------------------------------------------- Constructor @@ -627,7 +627,7 @@ * @return the timeout * @since 5.5.25 */ - public long getTimeout() { + public int getTimeout() { return timeout; } @@ -635,7 +635,7 @@ * @param timeout the timeout to set * @since 5.5.25 */ - public void setTimeout(long timeout) { + public void setTimeout(int timeout) { this.timeout = timeout; } @@ -666,7 +666,7 @@ * @deprecated since 5.5.25 use timeout instead */ public void setAckTimeout(long ackTimeout) { - this.timeout = ackTimeout; + this.timeout = (int)ackTimeout; } public long getKeepAliveTimeout() { @@ -892,15 +892,15 @@ protected void createSocket() throws IOException, SocketException { SocketAddress sockAddr = new InetSocketAddress(getAddress(), getPort()); socket = new Socket(); - int timeout = (int) getTimeout(); + int timeout = getTimeout(); if (timeout > 0) { socket.connect(sockAddr, timeout); + socket.setSoTimeout(timeout); } else { socket.connect(sockAddr); } socket.setSendBufferSize(getTxBufSize()); socket.setReceiveBufferSize(getRxBufSize()); - socket.setSoTimeout( (int) getTimeout()); socket.setTcpNoDelay(isTcpNoDelay()); socket.setKeepAlive(isSoKeepAlive()); socket.setReuseAddress(isSoReuseAddress()); @@ -1125,10 +1125,8 @@ new Long(this.timeout)); if ( !this.isSuspect() ) { this.setSuspect(true); - if ( log.isWarnEnabled() ) log.warn(errmsg, x); - } else { - if ( log.isDebugEnabled() )log.debug(errmsg, x); } + if ( log.isDebugEnabled() ) log.debug(errmsg, x); throw x; } finally { if(doWaitAckStats) { Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java?view=diff&rev=567298&r1=567297&r2=567298 ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java Sat Aug 18 10:14:07 2007 @@ -162,7 +162,8 @@ channel.socket().setReuseAddress(isSoReuseAddress()); channel.socket().setSoLinger(isSoLingerOn(),getSoLingerTime()); channel.socket().setTrafficClass(getSoTrafficClass()); - channel.socket().setSoTimeout(getTimeout()); + if(getTimeout() > -1) + channel.socket().setSoTimeout(getTimeout()); // attach Reader and register channel Object attach = new ObjectReader(channel, selector, this) ; Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationListener.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationListener.java?view=diff&rev=567298&r1=567297&r2=567298 ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationListener.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationListener.java Sat Aug 18 10:14:07 2007 @@ -162,7 +162,8 @@ socket.setReuseAddress(isSoReuseAddress()); socket.setSoLinger(isSoLingerOn(),getSoLingerTime()); socket.setTrafficClass(getSoTrafficClass()); - socket.setSoTimeout(getTimeout()); + if( getTimeout() > -1) + socket.setSoTimeout(getTimeout()); // Switch to separate thread and read all messages SocketReplicationThread t = new SocketReplicationThread( this, socket); Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationThread.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationThread.java?view=diff&rev=567298&r1=567297&r2=567298 ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationThread.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketReplicationThread.java Sat Aug 18 10:14:07 2007 @@ -20,6 +20,7 @@ import java.io.InputStream; import java.net.Socket; import java.net.SocketException; +import java.net.SocketTimeoutException; import org.apache.catalina.cluster.io.ListenCallback; import org.apache.catalina.cluster.io.SocketObjectReader; @@ -74,6 +75,7 @@ InputStream in = socket.getInputStream(); while (keepRunning) { int cnt = in.read(buffer); + // ignore this: normal read timeout if (log.isTraceEnabled()) { log.trace("read " + cnt + " bytes from " + socket.getPort()); } @@ -88,6 +90,8 @@ // EOF keepRunning = false; } + } catch (SocketTimeoutException se) { + // ignore this: normal shutdown or stop listen socket } catch (SocketException se) { // ignore this: normal shutdown or stop listen socket } catch (IOException x) { @@ -96,7 +100,6 @@ // finish socket if (socket != null) { try { - socket.close(); } catch (Exception ignore) { } Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml?view=diff&rev=567298&r1=567297&r2=567298 ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml Sat Aug 18 10:14:07 2007 @@ -121,7 +121,7 @@ description="number of tcp listener worker threads" type="int"/> <attribute name="tcpSelectorTimeout" - description="tcp listener Selector timeout" + description="tcp listener Selector timeout (msec)" type="long"/> <attribute name="soTrafficClass" description="traffic class (default 0x04 | 0x08 | 0x010)" @@ -153,10 +153,10 @@ is="true" type="boolean" /> <attribute name="soLingerTime" - description="if soLingerOn use soLingerTime (default 3)" + description="if soLingerOn use soLingerTime (default 3 msec)" type="int"/> <attribute name="timeout" - description="soTimeout and acknowledge timeout (default 3000 msec)" + description="soTimeout and acknowledge timeout (default no timeout (-1), use msec)" type="long"/> <attribute name="nrOfMsgsReceived" description="number of messages received from other nodes" @@ -167,19 +167,19 @@ type="long" writeable="false"/> <attribute name="receivedProcessingTime" - description="received processing time" + description="received processing time (msec)" type="long" writeable="false"/> - <attribute name="minReceivedProcessingTime" + <attribute name="minReceivedProcessingTime (msec)" description="minimal received processing time" type="long" writeable="false"/> <attribute name="avgReceivedProcessingTime" - description="received processing time / nrOfRequests" + description="received processing time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxReceivedProcessingTime" - description="maximal received processing time" + description="maximal received processing time (msec)" type="long" writeable="false"/> <attribute name="doReceivedProcessingStats" @@ -187,7 +187,7 @@ is="true" type="boolean" /> <attribute name="avgTotalReceivedBytes" - description="received totalReceivedBytes / nrOfMsgsReceived" + description="received totalReceivedBytes / nrOfMsgsReceived (msec)" type="long" writeable="false"/> <attribute name="totalReceivedBytes" @@ -285,29 +285,29 @@ is="true" type="boolean" /> <attribute name="soLingerTime" - description="if soLingerOn use soLingerTime (default 3)" + description="if soLingerOn use soLingerTime (default 3 msec)" type="int"/> <attribute name="timeout" - description="soTimeout and acknowledge timeout (default 3000 msec)" + description="soTimeout and acknowledge timeout (default no timeout (-1), use msec)" type="long"/> <attribute name="receivedTime" - description="total time message send time" + description="total time message send time (msec)" type="long" writeable="false"/> <attribute name="receivedProcessingTime" - description="received processing time" + description="received processing time (msec)" type="long" writeable="false"/> <attribute name="minReceivedProcessingTime" - description="minimal received processing time" + description="minimal received processing time (msec)" type="long" writeable="false"/> <attribute name="avgReceivedProcessingTime" - description="received processing time / nrOfRequests" + description="received processing time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxReceivedProcessingTime" - description="maximal received processing time" + description="maximal received processing time (msec)" type="long" writeable="false"/> <attribute name="doReceivedProcessingStats" @@ -315,7 +315,7 @@ is="true" type="boolean" /> <attribute name="avgTotalReceivedBytes" - description="received totalReceivedBytes / nrOfMsgsReceived" + description="received totalReceivedBytes / nrOfMsgsReceived (msec)" type="long" writeable="false"/> <attribute name="totalReceivedBytes" @@ -371,7 +371,7 @@ description="replication mode (synchnous,pooled.asynchnous,fastasyncqueue)" type="java.lang.String"/> <attribute name="ackTimeout" - description="acknowledge timeout" + description="acknowledge timeout (msec)" type="long"/> <attribute name="autoConnect" description="is sender disabled, fork a new socket" @@ -383,18 +383,18 @@ type="boolean" writeable="false" /> <attribute name="processingTime" - description="sending processing time" + description="sending processing time (msec)" type="long" writeable="false"/> <attribute name="minProcessingTime" - description="minimal sending processing time" + description="minimal sending processing time (msec)" type="long" writeable="false"/> <attribute name="avgProcessingTime" - description="processing time / nrOfRequests" + description="processing time / nrOfRequests (msec)" type="double" writeable="false"/> - <attribute name="maxProcessingTime" + <attribute name="maxProcessingTime (msec)" description="maximal sending processing time" type="long" writeable="false"/> @@ -489,17 +489,17 @@ is="true" type="boolean" /> <attribute name="soLingerTime" - description="if soLingerOn use soLingerTime (default 3)" + description="if soLingerOn use soLingerTime (default 3 msec)" type="int"/> <attribute name="timeout" - description="connect and acknowledge timeout (default 3000 msec)" + description="connect and acknowledge timeout (default 30000 msec)" type="long"/> <attribute name="ackTimeout" description="acknowledge timeout acknowledge timeout (deprecated use timeout)" type="long"/> <attribute name="avgMessageSize" writeable="false" - description="avg message size (totalbytes/nrOfRequests" + description="avg message size (totalbytes/nrOfRequests)" type="long"/> <attribute name="queueSize" writeable="false" @@ -515,7 +515,7 @@ is="true" writeable="false"/> <attribute name="keepAliveTimeout" - description="active socket keep alive timeout" + description="active socket keep alive timeout (msec)" type="long"/> <attribute name="keepAliveMaxRequestCount" description="max request over this socket" @@ -525,7 +525,7 @@ type="int" writeable="false"/> <attribute name="keepAliveConnectTime" - description="Connect time for keep alive" + description="Connect time for keep alive (msec)" type="long" writeable="false"/> <attribute name="resend" @@ -546,19 +546,19 @@ type="long" writeable="false"/> <attribute name="processingTime" - description="sending processing time" + description="sending processing time (msec)" type="long" writeable="false"/> <attribute name="minProcessingTime" - description="minimal sending processing time" + description="minimal sending processing time (msec)" type="long" writeable="false"/> <attribute name="avgProcessingTime" - description="processing time / nrOfRequests" + description="processing time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxProcessingTime" - description="maximal sending processing time" + description="maximal sending processing time (msec)" type="long" writeable="false"/> <attribute name="doProcessingStats" @@ -566,19 +566,19 @@ is="true" type="boolean" /> <attribute name="waitAckTime" - description="sending waitAck time" + description="sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="minWaitAckTime" - description="minimal sending waitAck time" + description="minimal sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="avgWaitAckTime" - description="waitAck time / nrOfRequests" + description="waitAck time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxWaitAckTime" - description="maximal sending waitAck time" + description="maximal sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="doWaitAckStats" @@ -709,14 +709,14 @@ description="if soLingerOn use soLingerTime (default 3)" type="int"/> <attribute name="timeout" - description="connect and acknowledge timeout (default 3000 msec)" - type="long"/> + description="connect and acknowledge timeout (default 30000 msec)" + type="int"/> <attribute name="ackTimeout" description="acknowledge timeout (deprecated use timeout)" type="long"/> <attribute name="avgMessageSize" writeable="false" - description="avg message size (totalbytes/nrOfRequests" + description="avg message size (totalbytes/nrOfRequests) (msec)" type="long" /> <attribute name="queueSize" writeable="false" @@ -732,7 +732,7 @@ is="true" writeable="false"/> <attribute name="keepAliveTimeout" - description="active socket keep alive timeout" + description="active socket keep alive timeout (msec)" type="long"/> <attribute name="keepAliveMaxRequestCount" description="max request over this socket" @@ -747,7 +747,7 @@ description="max queue length" type="int"/> <attribute name="queueTimeWait" - description="remember queue wait times" + description="remember queue wait times (msec)" is="true" type="boolean"/> <attribute name="queueCheckLock" @@ -763,11 +763,11 @@ type="int" writeable="false"/> <attribute name="keepAliveConnectTime" - description="Connect time for keep alive" + description="Connect time for keep alive (msec)" type="long" writeable="false"/> <attribute name="resend" - description="after send failure make a resend" + description="after send failure make a resend (default true)" is="true" type="boolean" /> <attribute name="recoverTimeout" @@ -790,19 +790,19 @@ type="long" writeable="false"/> <attribute name="processingTime" - description="sending processing time" + description="sending processing time (msec)" type="long" writeable="false"/> <attribute name="minProcessingTime" - description="minimal sending processing time" + description="minimal sending processing time (msec)" type="long" writeable="false"/> <attribute name="avgProcessingTime" - description="processing time / nrOfRequests" + description="processing time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxProcessingTime" - description="maximal sending processing time" + description="maximal sending processing time (msec)" type="long" writeable="false"/> <attribute name="doProcessingStats" @@ -810,19 +810,19 @@ is="true" type="boolean" /> <attribute name="waitAckTime" - description="sending waitAck time" + description="sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="minWaitAckTime" - description="minimal sending waitAck time" + description="minimal sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="avgWaitAckTime" - description="waitAck time / nrOfRequests" + description="waitAck time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxWaitAckTime" - description="maximal sending waitAck time" + description="maximal sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="doWaitAckStats" @@ -870,11 +870,11 @@ type="long" writeable="false"/> <attribute name="queueAddWaitTime" - description="queue add wait time (tomcat thread waits)" + description="queue add wait time (tomcat thread waits) (msec)" type="long" writeable="false"/> <attribute name="queueRemoveWaitTime" - description="queue remove wait time (queue thread waits)" + description="queue remove wait time (queue thread waits) (msec)" type="long" writeable="false"/> <operation name="connect" @@ -949,8 +949,8 @@ description="if soLingerOn use soLingerTime (default 3)" type="int"/> <attribute name="timeout" - description="connect and acknowledge timeout (default 3000 msec)" - type="long"/> + description="connect and acknowledge timeout (default 30000 msec)" + type="int"/> <attribute name="ackTimeout" description="acknowledge timeout (deprecated use timeout)" type="long"/> @@ -969,7 +969,7 @@ description="get size of current busy SocketSender from pool" type="int"/> <attribute name="keepAliveTimeout" - description="active socket keep alive timeout" + description="active socket keep alive timeout (msec)" type="long"/> <attribute name="keepAliveMaxRequestCount" description="max request over this socket" @@ -1070,18 +1070,18 @@ description="if soLingerOn use soLingerTime (default 3)" type="int"/> <attribute name="timeout" - description="connect and acknowledge timeout (default 3000 msec)" - type="long"/> + description="connect and acknowledge timeout (default 30000 msec)" + type="int"/> <attribute name="ackTimeout" description="acknowledge timeout (deprecated use timeout)" type="long"/> <attribute name="waitForAck" - description="Wait for ack after data send" + description="Wait for ack after data send (default false)" is="true" type="boolean" writeable="false" /> <attribute name="keepAliveTimeout" - description="active socket keep alive timeout" + description="active socket keep alive timeout (msec)" type="long"/> <attribute name="keepAliveMaxRequestCount" description="max request over this socket" @@ -1096,7 +1096,7 @@ type="int" writeable="false"/> <attribute name="keepAliveConnectTime" - description="Connect time for keep alive" + description="Connect time for keep alive (msec)" type="long" writeable="false"/> <attribute name="resend" @@ -1110,7 +1110,7 @@ writeable="false"/> <attribute name="avgMessageSize" writeable="false" - description="avg message size (totalbytes/nrOfRequests" + description="avg message size (totalbytes/nrOfRequests)" type="long"/> <attribute name="nrOfRequests" description="number of send messages to other members" @@ -1121,19 +1121,19 @@ type="long" writeable="false"/> <attribute name="processingTime" - description="sending processing time" + description="sending processing time (msec)" type="long" writeable="false"/> <attribute name="minProcessingTime" - description="minimal sending processing time" + description="minimal sending processing time (msec)" type="long" writeable="false"/> <attribute name="avgProcessingTime" - description="processing time / nrOfRequests" + description="processing time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxProcessingTime" - description="maximal sending processing time" + description="maximal sending processing time (msec)" type="long" writeable="false"/> <attribute name="doProcessingStats" @@ -1141,19 +1141,19 @@ is="true" type="boolean" /> <attribute name="waitAckTime" - description="sending waitAck time" + description="sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="minWaitAckTime" - description="minimal sending waitAck time" + description="minimal sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="avgWaitAckTime" - description="waitAck time / nrOfRequests" + description="waitAck time / nrOfRequests (msec)" type="double" writeable="false"/> <attribute name="maxWaitAckTime" - description="maximal sending waitAck time" + description="maximal sending waitAck time (msec)" type="long" writeable="false"/> <attribute name="doWaitAckStats" @@ -1255,15 +1255,15 @@ type="long" writeable="false"/> <attribute name="totalRequestTime" - description="total replicated request time" + description="total replicated request time (msec)" type="long" writeable="false"/> <attribute name="totalSendTime" - description="total replicated send time" + description="total replicated send time (msec)" type="long" writeable="false"/> <attribute name="lastSendTime" - description="last replicated request time" + description="last replicated request time (msec)" type="long" writeable="false"/> <operation name="resetStatistics" --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]