From: Alex Rousskov Date: Wed, 24 Jul 2013 21:48:45 +0000 (-0600) Subject: Disconnect StoreEntries before deleting their memory objects. X-Git-Tag: SQUID_3_5_0_1~444^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa6d2c655fb884b65eb2c2c044a81233a987a06f;p=thirdparty%2Fsquid.git Disconnect StoreEntries before deleting their memory objects. The new cleanup order helps identify the write Rock entry state (reading or writing) and avoid assertions related to state identification bugs (such as unlocking a writing entry for reading). Similar to the memory cache code, we should not disconnect disk entries during shutdown because Store::Root() may be missing by then. --- diff --git a/src/store.cc b/src/store.cc index 1dfd617aea..b1004cd483 100644 --- a/src/store.cc +++ b/src/store.cc @@ -397,10 +397,6 @@ StoreEntry::StoreEntry() : StoreEntry::~StoreEntry() { - if (swap_filen >= 0) { - SwapDir &sd = dynamic_cast(*store()); - sd.disconnect(*this); - } } #if USE_ADAPTATION @@ -452,6 +448,12 @@ destroyStoreEntry(void *data) if (e == NullStoreEntry::getInstance()) return; + // Store::Root() is FATALly missing during shutdown + if (e->swap_filen >= 0 && !shutting_down) { + SwapDir &sd = dynamic_cast(*e->store()); + sd.disconnect(*e); + } + e->destroyMemObject(); e->hashDelete();