]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: wessels
authorhno <>
Fri, 31 Aug 2007 01:26:10 +0000 (01:26 +0000)
committerhno <>
Fri, 31 Aug 2007 01:26:10 +0000 (01:26 +0000)
Bug #1945: assertion failed: store_swapin.cc:47:  "e->mem_status == NOT_IN_MEMORY"

There seems to be a race condition which may leave small objects (<4KB) in an
inconsistent internal state where Squid thinks the object is kept in memory
but part of it has been freed..

This patch closes this race condition.

src/store.cc

index ef9e1203f10f4a51cb40cbb20116caad8ea40cf5..a6b6b8a0188e2f3100d90183714e5bf42efa7289 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.617 2007/08/27 12:50:43 hno Exp $
+ * $Id: store.cc,v 1.618 2007/08/30 19:26:10 hno Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -1841,12 +1841,18 @@ StoreEntry::swapoutPossible()
 void
 StoreEntry::trimMemory()
 {
+    /*
+     * DPW 2007-05-09
+     * Bug #1943.  We must not let go any data for IN_MEMORY
+     * objects.  We have to wait until the mem_status changes.
+     */
+    if (mem_status == IN_MEMORY)
+       return;
+
     if (mem_obj->policyLowestOffsetToKeep() == 0)
         /* Nothing to do */
         return;
 
-    assert (mem_obj->policyLowestOffsetToKeep() > 0);
-
     if (!swapOutAble()) {
         /*
          * Its not swap-able, and we're about to delete a chunk,