From: wessels <> Date: Tue, 18 Apr 2000 12:06:17 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~2041 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50a49a6fc26dc4bdb8be863b282aaac73dd99f49;p=thirdparty%2Fsquid.git DW: - 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. --- diff --git a/src/store_client.cc b/src/store_client.cc index efcd0a0f43..700bfe2624 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -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) { diff --git a/src/store_swapout.cc b/src/store_swapout.cc index baa5cab967..c1ab144f67 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -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)) { /*