From fa22b51202ba63dafbd31082cc049698fc9c8cae Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sun, 12 Sep 2021 19:03:39 +0000 Subject: [PATCH] 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. --- src/store_swapout.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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. -- 2.47.3