]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Tue, 18 Apr 2000 12:06:17 +0000 (12:06 +0000)
committerwessels <>
Tue, 18 Apr 2000 12:06:17 +0000 (12:06 +0000)
 - storeSwapout() has a recently-added bug that causes huge amounts
   of memory to get tied up for some pending requests.  Observed what
   seemed to be a "Range" request where store_client->copy_offset
   was larger than MemObject->inmem_hi.  That is, the server side
   didn't yet get the data that the client wants.  In this case, the
   whole object was being stored in memory.

   The cause was the recent change so that more objects can be
   cached in memory, rather than always freeing up to the lowest
   reader offset.

   The fix (hack?) is to check the case when lowest offset is larger
   than inmem_hi.  It also requires changing storeLowestMemReaderOffset
   so that the initial "low_offset" is inmem_hi+1.

src/store_client.cc
src/store_swapout.cc

index efcd0a0f43c5af0a1b8b8cc3dec418a24caf4e8f..700bfe26249cdf36339525bb6cfdb05465471583 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_client.cc,v 1.85 2000/03/25 05:14:04 wessels Exp $
+ * $Id: store_client.cc,v 1.86 2000/04/18 06:06:17 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Client-Side Interface
  * AUTHOR: Duane Wessels
@@ -520,7 +520,7 @@ off_t
 storeLowestMemReaderOffset(const StoreEntry * entry)
 {
     const MemObject *mem = entry->mem_obj;
-    off_t lowest = mem->inmem_hi;
+    off_t lowest = mem->inmem_hi + 1;
     store_client *sc;
     store_client *nx = NULL;
     for (sc = mem->clients; sc; sc = nx) {
index baa5cab967f4070596fa710b826cb42b7617740a..c1ab144f6748b592fd46f60c304e0ccf4727962a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.63 2000/03/06 16:24:56 wessels Exp $
+ * $Id: store_swapout.cc,v 1.64 2000/04/18 06:06:17 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -108,10 +108,16 @@ storeSwapOut(StoreEntry * e)
     lowest_offset = storeLowestMemReaderOffset(e);
     debug(20, 7) ("storeSwapOut: lowest_offset = %d\n",
        (int) lowest_offset);
-    if (mem->inmem_hi - lowest_offset > DISK_PAGE_SIZE)
-        new_mem_lo = lowest_offset;
+    /*
+     * Careful.  lowest_offset can be greater than inmem_hi, such
+     * as in the case of a range request.
+     */
+    if (mem->inmem_hi < lowest_offset)
+       new_mem_lo = lowest_offset;
+    else if (mem->inmem_hi - lowest_offset > DISK_PAGE_SIZE)
+       new_mem_lo = lowest_offset;
     else
-        new_mem_lo = mem->inmem_lo;
+       new_mem_lo = mem->inmem_lo;
     assert(new_mem_lo >= mem->inmem_lo);
     if (storeSwapOutAble(e)) {
        /*