From: Alex Rousskov Date: Sat, 21 Jul 2012 01:16:32 +0000 (-0600) Subject: Bug 3551: store_rebuild.cc:116: "store_errors == 0" assertion X-Git-Tag: SQUID_3_2_0_19~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=256b2a8e07c59b99116414697780c93ffb4de0b4;p=thirdparty%2Fsquid.git Bug 3551: store_rebuild.cc:116: "store_errors == 0" assertion Fail with an explanation instead of asserting. The assertion fails when a ufs cache_dir's swap.state has inconsistencies AND the user starts Squid with a -S command line option. Normally, such inconsistencies are ignored and many of them are benign. For example, a missing cache file with an ADD record in swap.state is such an inconsistency. The -S option was meant to help developers troubleshoot inconsistencies by analyzing core dumps, but (a) admins treat assertions as Squid bugs and file bug reports and (b) in most cases, it is really difficult to find the inconsistency when Squid asserts after detecting all of them (and leaving the detection context). We now explicitly tell the admin what their options are and quit instead of asserting. TODO: Consider adding a ufs cache_dir option that checks for and removes inconsistencies instead of not checking at all (default) or checking and quitting (-S). This is difficult because some valid cache entries may look inconsistent while they are being updated and some invalid cache entries are not visible to Squid without a full directory scan. --- diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index 521cf26b68..e52280a409 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -112,8 +112,12 @@ storeCleanup(void *datanotused) StoreController::store_dirs_rebuilding--; assert(0 == StoreController::store_dirs_rebuilding); - if (opt_store_doublecheck) - assert(store_errors == 0); + if (opt_store_doublecheck && store_errors) { + fatalf("Quitting after finding %d cache index inconsistencies. " \ + "Removing cache index will force its slow rebuild. " \ + "Removing -S will let Squid start with an inconsistent " \ + "cache index (at your own risk).\n", store_errors); + } if (store_digest) storeDigestNoteStoreReady();