tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r988645 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProcessor.java java/org/apache/coyote/http11/Http11NioProtocol.java webapps/docs/changelog.xml
Date Tue, 24 Aug 2010 18:12:51 GMT
Author: markt
Date: Tue Aug 24 18:12:51 2010
New Revision: 988645

URL: http://svn.apache.org/viewvc?rev=988645&view=rev
Log:
Fix some edge cases in the NIO connector when handling requests that are not received all
at the same time and the socket needs to be returned to the poller.
This should fix the current Gump failures in the NIO tests.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=988645&r1=988644&r2=988645&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Tue Aug 24 18:12:51
2010
@@ -308,13 +308,18 @@ public class Http11NioProcessor extends 
                     socket.getIOChannel().socket().setSoTimeout((int)soTimeout);
                 }
                 if (!inputBuffer.parseRequestLine(keptAlive)) {
-                    //no data available yet, since we might have read part
-                    //of the request line, we can't recycle the processor
+                    // Haven't finished reading the request so keep the socket
+                    // open
                     openSocket = true;
-                    recycle = false;
+                    // Check to see if we have read any of the request line yet
                     if (inputBuffer.getParsingRequestLinePhase()<2) {
-                        //keep alive timeout here
+                        // No data read, OK to recycle the processor
+                        // Continue to use keep alive timeout
                         if (keepAliveTimeout>0) ka.setTimeout(keepAliveTimeout);
+                    } else {
+                        // Started to read request line. Need to keep processor
+                        // associated with socket
+                        recycle = false;
                     }
                     break;
                 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=988645&r1=988644&r2=988645&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Tue Aug 24 18:12:51
2010
@@ -365,10 +365,8 @@ public class Http11NioProtocol extends A
 
                 SocketState state = processor.process(socket);
                 if (state == SocketState.LONG) {
-                    // Associate the connection with the processor. The next request 
-                    // processed by this thread will use either a new or a recycled
-                    // processor.
-                    //if (log.isDebugEnabled()) log.debug("Not recycling ["+processor+"]
Comet="+((NioEndpoint.KeyAttachment)socket.getAttachment(false)).getComet());
+                    // In the middle of processing a request/response. Keep the
+                    // socket associated with the processor.
                     connections.put(socket, processor);
                     
                     if (processor.comet) {
@@ -378,11 +376,15 @@ public class Http11NioProtocol extends A
                         NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
                         att.setAsync(true);
                     } else {
-                        //we should not hold on to the processor objects
-                        release(socket);
                         socket.getPoller().add(socket);
                     }
+                } else if (state == SocketState.OPEN){
+                    // In keep-alive but between requests. OK to recycle
+                    // processor. Continue to poll for the next request.
+                    socket.getPoller().add(socket);
+                    recycledProcessors.offer(processor);
                 } else {
+                    // Connection closed. OK to recycle the processor.
                     recycledProcessors.offer(processor);
                 }
                 return state;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=988645&r1=988644&r2=988645&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Aug 24 18:12:51 2010
@@ -92,6 +92,11 @@
         Follow up to <bug>48545</bug>. Make JSSE connectors more tolerant of
a
         incorrect trust store password. (markt)
       </add>
+      <fix>
+        Fix some edge cases in the NIO connector when handling requests that are
+        not received all at the same time and the socket needs to be returned to
+        the poller. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message