You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/02/13 22:54:11 UTC

svn commit: r1568056 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_subr/cache-membuffer.c

Author: breser
Date: Thu Feb 13 21:54:10 2014
New Revision: 1568056

URL: http://svn.apache.org/r1568056
Log:
Merge the 1.8.x-r1567985 branch:

 * r1567985
   Infinite loop in caching code on 32 bit platforms.
   Branch: ^/subversion/branches/1.8.x-r1567985
   Justification:
     This affects all threaded servers and gets more frequent when only small
     caches like the 16MB default have been configured.  Once a thread enters
     the infinite loop, all other threads in the same process will soon hang
     as well.
   Votes:
     +1: stefan2, breser, philip

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_subr/cache-membuffer.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1567985
  Merged /subversion/branches/1.8.x-r1567985:r1568016-1568055

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1568056&r1=1568055&r2=1568056&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Thu Feb 13 21:54:10 2014
@@ -196,14 +196,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1567985
-   Infinite loop in caching code on 32 bit platforms.
-   Branch: ^/subversion/branches/1.8.x-r1567985
-   Justification:
-     This affects all threaded servers and gets more frequent when only small
-     caches like the 16MB default have been configured.  Once a thread enters
-     the infinite loop, all other threads in the same process will soon hang
-     as well.
-   Votes:
-     +1: stefan2, breser, philip

Modified: subversion/branches/1.8.x/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/cache-membuffer.c?rev=1568056&r1=1568055&r2=1568056&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_subr/cache-membuffer.c Thu Feb 13 21:54:10 2014
@@ -422,7 +422,7 @@ struct svn_membuffer_t
    */
   apr_uint64_t current_data;
 
-  /* Total number of data buffer bytes in use. This is for statistics only.
+  /* Total number of data buffer bytes in use.
    */
   apr_uint64_t data_used;
 
@@ -1374,7 +1374,11 @@ membuffer_cache_set_internal(svn_membuff
    * the old spot, just re-use that space. */
   if (entry && ALIGN_VALUE(entry->size) >= size && buffer)
     {
-      cache->data_used += size - entry->size;
+      /* Careful! We need to cast SIZE to the full width of CACHE->DATA_USED
+       * lest we run into trouble with 32 bit underflow *not* treated as a
+       * negative value.
+       */
+      cache->data_used += (apr_uint64_t)size - entry->size;
       entry->size = size;
 
 #ifdef SVN_DEBUG_CACHE_MEMBUFFER