Author: remy.maucherat(a)jboss.com
Date: 2008-10-31 13:10:39 -0400 (Fri, 31 Oct 2008)
New Revision: 836
Modified:
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Log:
- Handle cases where process fails, remove timeout in some cases.
- Do setTimeout after recycling, as I've seen it fail (JBWEB-125).
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2008-10-31 17:08:53 UTC
(rev 835)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2008-10-31 17:10:39 UTC
(rev 836)
@@ -269,10 +269,10 @@
req.getRequestProcessor().setWorkerThreadName(null);
// Recycle the wrapper request and response
if (error || close || response.isClosed()) {
- res.action(ActionCode.ACTION_COMET_END, null);
request.recycle();
request.setFilterChain(null);
response.recycle();
+ res.action(ActionCode.ACTION_COMET_END, null);
}
}
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-10-31 17:08:53 UTC
(rev 835)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-10-31 17:10:39 UTC
(rev 836)
@@ -1259,9 +1259,9 @@
} else if (actionCode == ActionCode.ACTION_COMET_END) {
comet = false;
// End non blocking mode
- Socket.timeoutSet(socket, endpoint.getSoTimeout() * 1000);
outputBuffer.setNonBlocking(false);
inputBuffer.setNonBlocking(false);
+ Socket.timeoutSet(socket, endpoint.getSoTimeout() * 1000);
} else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
readNotifications = false;
} else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2008-10-31 17:08:53 UTC (rev
835)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2008-10-31 17:10:39 UTC (rev
836)
@@ -1669,7 +1669,9 @@
// Resume event
timeouts.remove(info.socket);
removeFromPoller(info.socket);
- processSocket(info.socket,
SocketStatus.OPEN_CALLBACK);
+ if (!processSocket(info.socket,
SocketStatus.OPEN_CALLBACK)) {
+ Socket.destroy(info.socket);
+ }
} else {
// Store timeout
timeouts.add(info.socket, System.currentTimeMillis()
+ info.timeout);
@@ -1680,6 +1682,7 @@
| ((info.write()) ? Poll.APR_POLLOUT : 0);
if (!addToPoller(info.socket, events)) {
// Can't do anything: close the socket right
away
+ timeouts.remove(info.socket);
if (!comet || (comet &&
!processSocket(info.socket, SocketStatus.ERROR))) {
Socket.destroy(info.socket);
}
@@ -1692,7 +1695,9 @@
// Resume event
timeouts.remove(info.socket);
removeFromPoller(info.socket);
- processSocket(info.socket,
SocketStatus.OPEN_CALLBACK);
+ if (!processSocket(info.socket,
SocketStatus.OPEN_CALLBACK)) {
+ Socket.destroy(info.socket);
+ }
} else {
// Suspend
timeouts.add(info.socket,
System.currentTimeMillis() + info.timeout);
@@ -1700,7 +1705,9 @@
} else {
// Should never happen, if not Comet, the socket is
always put in
// the list with the read flag.
+ timeouts.remove(info.socket);
Socket.destroy(info.socket);
+
log.error(sm.getString("endpoint.poll.error"));
}
}
info = localAddList.get();
Show replies by date