Log the URL when getting a cache OpenReadHead warning
Log the URL when getting a cache OpenReadHead warning when the content
length header doesn't match the document/object length in cache
I added that code to 9.2.4 but it crashed. Is there a way to test this code without having to put in production?
I might have wrongly applied the patch:
$ git diff HEAD~1
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 95e8b1838..b858a0d98 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -1182,8 +1182,11 @@ CacheVC::openReadStartHead(int event, Event *e)
if (field) {
uint64_t cl = static_cast<uint64_t>(field->value_get_int64());
if (cl != doc_len) {
- Warning("OpenReadHead failed for cachekey %X : alternate content length doesn't match doc_len %" PRId64 " != %" PRId64,
- key.slice32(0), cl, doc_len);
+ int url_string_length = 0;
+ const char *url_string = alternate.response_get()->url_get()->string_get_ref(&url_string_length);
+ Warning("OpenReadHead failed for cachekey %X : alternate content length doesn't match doc_len %" PRId64 " != %" PRId64
+ " url: %.*s",
+ key.slice32(0), cl, doc_len, url_string_length, url_string);
CACHE_INCREMENT_DYN_STAT(cache_read_invalid_stat);
err = ECACHE_BAD_META_DATA;
goto Ldone;
Should this be using request.url_get()->string_get_ref(&url_string_length); instead of alternate.response_get()->url_get()->string_get_ref(&url_string_length); ?
This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.
@bryancall you still want this change since its been stale for a while?