Ensure the asynchronous requests never timeout if the timeout is set to zero or less.
Based on a patch provided by Chris.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@
1094088 13f79535-47bb-0310-9956-
ffa450edef68
SocketWrapper<Long> socket = sockets.next();
if (socket.async) {
long access = socket.getLastAccess();
- if ((now-access)>socket.getTimeout()) {
+ if (socket.getTimeout() > 0 &&
+ (now-access)>socket.getTimeout()) {
processSocketAsync(socket,SocketStatus.TIMEOUT);
}
}
while (sockets.hasNext()) {
SocketWrapper<Socket> socket = sockets.next();
long access = socket.getLastAccess();
- if ((now-access)>socket.getTimeout()) {
+ if (socket.getTimeout() > 0 &&
+ (now-access)>socket.getTimeout()) {
processSocketAsync(socket,SocketStatus.TIMEOUT);
}
}
nextExpiration = (nextTime < nextExpiration)?nextTime:nextExpiration;
}
} else if (ka.isAsync() || ka.getComet()) {
- long delta = now - ka.getLastAccess();
- long timeout = (ka.getTimeout()==-1)?((long) socketProperties.getSoTimeout()):(ka.getTimeout());
- boolean isTimedout = delta > timeout;
- if (isTimedout) {
- // Prevent subsequent timeouts if the timeout event takes a while to process
- ka.access(Long.MAX_VALUE);
- processSocket(ka.getChannel(), SocketStatus.TIMEOUT, true);
+ // Async requests with a timeout of 0 or less never timeout
+ if (!ka.isAsync() || ka.getTimeout() > 0) {
+ long delta = now - ka.getLastAccess();
+ long timeout = (ka.getTimeout()==-1)?((long) socketProperties.getSoTimeout()):(ka.getTimeout());
+ boolean isTimedout = delta > timeout;
+ if (isTimedout) {
+ // Prevent subsequent timeouts if the timeout event takes a while to process
+ ka.access(Long.MAX_VALUE);
+ processSocket(ka.getChannel(), SocketStatus.TIMEOUT, true);
+ }
}
}//end if
}catch ( CancelledKeyException ckx ) {
protected Integer performanceBandwidth = null;
/**
- * The minimum frequency of the timeout interval to avoid the
- * poller going boinkers during high traffic
+ * The minimum frequency of the timeout interval to avoid excess load from
+ * the poller during high traffic
*/
protected long timeoutInterval = 1000;
<bug>50957</bug>: Fix regression in HTTP BIO connector that triggered
errors when processing pipe-lined requests. (markt)
</fix>
+ <fix>
+ <bug>50158</bug>: Ensure the asynchronous requests never timeout if the
+ timeout is set to zero or less. Based on a patch provided by Chris.
+ (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">