Author: markt
Date: Wed Aug  5 19:37:23 2015
New Revision: 1694300

URL: http://svn.apache.org/r1694300
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58151
Correctly handle EOF in the AJP APR/native connector to prevent the connector 
entering a loop and generate excessive CPU load.

Modified:
    tomcat/tc8.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc8.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1694300&r1=1694299&r2=1694300&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Wed 
Aug  5 19:37:23 2015
@@ -197,9 +197,9 @@ public class AjpAprProcessor extends Abs
             nRead = readSocket(inputBuffer.limit(),
                     inputBuffer.capacity() - inputBuffer.limit(),
                     nextReadBlocks);
-            if (nRead == 0) {
-                // Must be a non-blocking read
-                return false;
+            if (nRead > 0) {
+                inputBuffer.limit(inputBuffer.limit() + nRead);
+                nextReadBlocks = true;
             } else if (-nRead == Status.EAGAIN) {
                 return false;
             } else if ((-nRead) == Status.ETIMEDOUT || (-nRead) == 
Status.TIMEUP) {
@@ -215,9 +215,6 @@ public class AjpAprProcessor extends Abs
                     // non-blocking read that returned no data.
                     return false;
                 }
-            } else if (nRead > 0) {
-                inputBuffer.limit(inputBuffer.limit() + nRead);
-                nextReadBlocks = true;
             } else {
                 throw new IOException(sm.getString("ajpprocessor.failedread"));
             }

Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1694300&r1=1694299&r2=1694300&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Wed Aug  5 19:37:23 2015
@@ -119,6 +119,11 @@
         requests so that the async timeout thread doesn't process it during the
         next request. (markt)
       </fix>
+      <fix>
+        <bug>58151</bug>: Correctly handle EOF in the AJP APR/native connector
+        to prevent the connector entering a loop and generate excessive CPU
+        load. (markt) 
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



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

Reply via email to