Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the URL when getting a cache OpenReadHead warning #11573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bryancall
Copy link
Contributor

Log the URL when getting a cache OpenReadHead warning when the content
length header doesn't match the document/object length in cache

length header doesn't match the document/object length in cache
@bryancall bryancall added this to the 10.1.0 milestone Jul 18, 2024
@bryancall bryancall self-assigned this Jul 18, 2024
@smalenfant
Copy link

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;

@smalenfant
Copy link

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); ?

Copy link

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.

@github-actions github-actions bot added the Stale label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready to Merge
Development

Successfully merging this pull request may close these issues.

4 participants