From: Alex Rousskov Date: Sun, 12 Sep 2021 19:03:39 +0000 (+0000) Subject: Fix "mem_obj->inmem_lo == 0" assertion in StoreEntry::swapOut() (#896) X-Git-Tag: SQUID_6_0_1~290 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa22b51202ba63dafbd31082cc049698fc9c8cae;p=thirdparty%2Fsquid.git Fix "mem_obj->inmem_lo == 0" assertion in StoreEntry::swapOut() (#896) 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. --- diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 1d59814616..abb2635ba4 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -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.