]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4493: theObject->sharedMemorySize() == theSegment.size() exception
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Apr 2016 22:36:12 +0000 (16:36 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Apr 2016 22:36:12 +0000 (16:36 -0600)
We should not expect the exact match because, as discovered during bug
3805 (r13947) fix, shared Segment::size() may exceed the originally
requested RAM amount due to stat() page rounding done by OSes like OS X.

Unfortunately, this rounding weakens the failed consistency check a lot.
TODO: Store the exact requested size and check against that as well.

src/ipc/mem/Pointer.h

index da183b158bbc1974edfa05c30611d6a6eedd790e..ec0fe149fb945ae1fc3c9a6de69da353b9fbdc20 100644 (file)
@@ -165,7 +165,7 @@ Object<Class>::Object(const char *const id): theSegment(id)
     theSegment.open();
     Must(theSegment.mem());
     theObject = reinterpret_cast<Class*>(theSegment.mem());
-    Must(static_cast<off_t>(theObject->sharedMemorySize()) == theSegment.size());
+    Must(static_cast<off_t>(theObject->sharedMemorySize()) <= theSegment.size());
 }
 
 template <class Class>