Author: markt
Date: Tue Sep 20 19:37:45 2016
New Revision: 1761628

URL: http://svn.apache.org/viewvc?rev=1761628&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60123
Avoid potential threading issues that could cause excessively large vales to be 
returned for the processing time of a current request.

Modified:
    tomcat/trunk/java/org/apache/coyote/RequestInfo.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/RequestInfo.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/RequestInfo.java?rev=1761628&r1=1761627&r2=1761628&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/RequestInfo.java (original)
+++ tomcat/trunk/java/org/apache/coyote/RequestInfo.java Tue Sep 20 19:37:45 
2016
@@ -123,8 +123,14 @@ public class RequestInfo  {
     }
 
     public long getRequestProcessingTime() {
-        if ( getStage() == org.apache.coyote.Constants.STAGE_ENDED ) return 0;
-        else return (System.currentTimeMillis() - req.getStartTime());
+        // Not perfect, but good enough to avoid returning strange values due 
to
+        // concurrent updates.
+        long startTime = req.getStartTime();
+        if (getStage() == org.apache.coyote.Constants.STAGE_ENDED || startTime 
< 0) {
+            return 0;
+        } else {
+            return System.currentTimeMillis() - startTime;
+        }
     }
 
     // -------------------- Statistical data  --------------------

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1761628&r1=1761627&r2=1761628&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Sep 20 19:37:45 2016
@@ -102,6 +102,11 @@
         Fail earlier if the client closes the connection during SNI processing.
         (markt)
       </fix>
+      <fix>
+        <bug>60123</bug>: Avoid potential threading issues that could cause
+        excessively large vales to be returned for the processing time of
+        a current request. (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