From: Amos Jeffries Date: Fri, 19 Feb 2016 15:06:42 +0000 (+1300) Subject: Revert r14303: Migrate StoreEntry to using MEMPROXY_CLASS X-Git-Tag: SQUID_4_0_7~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b9343492cced960b35f455504d13162155e8a8d;p=thirdparty%2Fsquid.git Revert r14303: Migrate StoreEntry to using MEMPROXY_CLASS This change has been identified as the trigger for several object caching errors. The real cause is not yet known, but reverting this optimisation avoids it, so is being done for stability. This resolves bugs 4370 and maybe also 4354 and 4355 --- diff --git a/src/Store.h b/src/Store.h index b20848ea2c..4f1aff44bf 100644 --- a/src/Store.h +++ b/src/Store.h @@ -40,7 +40,6 @@ extern StoreIoStats store_io_stats; class StoreEntry : public hash_link, public Packable { - MEMPROXY_CLASS(StoreEntry); public: static DeferredRead::DeferrableRead DeferReader; @@ -174,6 +173,8 @@ public: return false; }; + void *operator new(size_t byteCount); + void operator delete(void *address); void setReleaseFlag(); #if USE_SQUID_ESI diff --git a/src/store.cc b/src/store.cc index 834516c443..aff4dfe812 100644 --- a/src/store.cc +++ b/src/store.cc @@ -119,6 +119,26 @@ Store::Stats(StoreEntry * output) Root().stat(*output); } +// XXX: new/delete operators need to be replaced with MEMPROXY_CLASS +// definitions but doing so exposes bug 4370, and maybe 4354 and 4355 +void * +StoreEntry::operator new (size_t bytecount) +{ + assert(bytecount == sizeof (StoreEntry)); + + if (!pool) { + pool = memPoolCreate ("StoreEntry", bytecount); + } + + return pool->alloc(); +} + +void +StoreEntry::operator delete (void *address) +{ + pool->freeOne(address); +} + void StoreEntry::makePublic() { diff --git a/src/tests/stub_store.cc b/src/tests/stub_store.cc index 7daa3c51f2..ee4c891b21 100644 --- a/src/tests/stub_store.cc +++ b/src/tests/stub_store.cc @@ -76,6 +76,12 @@ size_t StoreEntry::inUseCount() STUB_RETVAL(0) void StoreEntry::getPublicByRequestMethod(StoreClient * aClient, HttpRequest * request, const HttpRequestMethod& method) STUB void StoreEntry::getPublicByRequest(StoreClient * aClient, HttpRequest * request) STUB void StoreEntry::getPublic(StoreClient * aClient, const char *uri, const HttpRequestMethod& method) STUB +void *StoreEntry::operator new(size_t byteCount) +{ + STUB + return new StoreEntry(); +} +void StoreEntry::operator delete(void *address) STUB void StoreEntry::setReleaseFlag() STUB //#if USE_SQUID_ESI //ESIElement::Pointer StoreEntry::cachedESITree STUB_RETVAL(NULL)