]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 4616: store_client.cc:92: "mem" assertion (#50)
authorEduard Bagdasaryan <dictiano@gmail.com>
Fri, 15 Sep 2017 14:13:01 +0000 (17:13 +0300)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 15 Sep 2017 14:13:01 +0000 (08:13 -0600)
commit76d61119ed913c9edd68aeb59ede23c10f119b34
treed29dd2d747227794d8dbe0592f1a7fbfbafbba40
parentc8736993652ff8afd2ad53b9d7010da7656a7c6d
Bug 4616: store_client.cc:92: "mem" assertion (#50)

This bug was probably caused by Bug 2833 feature/fix (1a210de).

The primary fix here is limited to clientReplyContext::processExpired():
Collapsed forwarding code must ensure StoreEntry::mem_obj existence. It
was missing for cache hits purged from (or never admitted into) the
memory cache. Most storeClientListAdd() callers either have similar code
or call storeCreateEntry() which also creates StoreEntry::mem_obj.

Also avoided clobbering known StoreEntry URIs/method in some cases. The
known effect of this change is fixed store.log URI and method fields
when a hit transaction did not match the stored entry exactly (e.g., a
HEAD hit for a GET cached entry), but this improvement may have even
more important consequences: The original method is used by possibly
still-running entry filling code (e.g., determining the end of the
incoming response, validating the entry length, finding vary markers,
etc.). Changing the method affects those actions, essentially corrupting
the entry state. The same argument may apply to store ID and log URI.

We even tried to make URIs/method constant, but that is impractical w/o
addressing an XXX in MemStore::get(), which is outside this issue scope.
To facilitate that future fix, the code now distinguishes these cases:

* createMemObject(void): Buggy callers that create a new memory object
  but do not know what URIs/method the hosting StoreEntry was based on.
  Once these callers are fixed, we can make the URIs/method constant.

* createMemObject(trio): Callers that create a new memory object with
  URIs/method that match the hosting StoreEntry.

* ensureMemObject(trio): Callers that are not sure whether StoreEntry
  has a memory object but have URIs/method to create one if needed.
src/MemObject.cc
src/MemObject.h
src/MemStore.cc
src/Store.h
src/client_side_reply.cc
src/store.cc
src/tests/stub_store.cc
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc