]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix "mem_obj->inmem_lo == 0" assertion in StoreEntry::swapOut() (#896)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 12 Sep 2021 19:03:39 +0000 (19:03 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 19 Sep 2021 08:00:41 +0000 (08:00 +0000)
Squid may stop writing to disk well before receiving the entire miss
response (e.g., because of swapout errors). When that happens, Squid
continues to call swapOut() to mem-cache the incoming response body.
Avoid the inapplicable disk-writing part of swapOut() in those cases.

src/store_swapout.cc

index 1d5981461625436517545bab2784d799ca83cbae..abb2635ba466eaee405e9cefc42cbfc4c6cb8bf4 100644 (file)
@@ -175,7 +175,10 @@ StoreEntry::swapOut()
     Store::Root().memoryOut(*this, weAreOrMayBeSwappingOut);
 
     if (mem_obj->swapout.decision < MemObject::SwapOut::swPossible)
-        return; // nothing else to do
+        return; // decided not to write to disk (at least for now)
+
+    if (!weAreOrMayBeSwappingOut)
+        return; // finished writing to disk after an earlier swStarted decision
 
     // Aborted entries have STORE_OK, but swapoutPossible rejects them. Thus,
     // store_status == STORE_OK below means we got everything we wanted.