Summary: | mod_cache doesn't re-cache expired content | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Darron Wood <darron.wood> |
Component: | mod_cache | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED LATER | ||
Severity: | normal | Keywords: | MassUpdate, PatchAvailable |
Priority: | P3 | ||
Version: | 2.0.49 | ||
Target Milestone: | --- | ||
Hardware: | Sun | ||
OS: | other | ||
Bug Depends on: | |||
Bug Blocks: | 30278 | ||
Attachments: |
modified mod_cache.c file that is delivered with 2.0.49
modified mod_disk_cache.c file that is delivered with 2.0.49 Patch for mod_disk_cache.c Patch for mod_cache.c |
Description
Darron Wood
2004-03-18 22:22:31 UTC
I just tested this in 2.0.49 and the same issue exists in this version also. I'm updating this bug to reflect that it also exists in 2.0.49. Created attachment 11169 [details]
modified mod_cache.c file that is delivered with 2.0.49
Created attachment 11170 [details]
modified mod_disk_cache.c file that is delivered with 2.0.49
I modified the mod_cache.c and mod_disk_cache.c files that are delievered with 2.0.49 and caching appears to be working now. I've attached the modified mod_cache.c and mod_disk_cache.c files from 2.0.49 to this bug. Could someone check out the changes I made and see if those are OK? Created attachment 11176 [details]
Patch for mod_disk_cache.c
Created attachment 11177 [details]
Patch for mod_cache.c
Attached diff output for both mod_cache.c and mod_disk_cache.c. I have installed the patches provided in this PR on Apache 2.0.49 and done extensive load testing. As far as I can tell, the cache now behaves correctly (both mem_cache and disk_cache). Expired files are updated. Thanks Darron, for providing the fixes. I may have rejoyced a little to quickly there... The problem was mostly fixed by the patch provided. Unfortunately, there seems to be another problem. On a reverse proxy, centuri, we have both disk cache and mem cache activated. The memory cache activated first and is only supposed to cache elements of size smaller than 10,000 bytes. The disk cache takes care of anything not cached by the memory cache. Somehow, at one point a file of size smaller than 10,000 bytes ends up being cached by the disk cache. Don't ask me why (maybe the mem cache was filled up and the element ended up on disk?) - it's beyond the point. Eventually, the file in disk cache ends up stale. At than point, when the element (style.css) is requested, the disk cache responds that it is stale and a proxy request is issued to the backend server. The fresh element ends up being cached in memory, and the stale entry remains in the disk cache... The logs below should clearly show what happens. mod_disk_cache does not appear to log the element as stale, but I know that the disk cache contains a stale copy of styles.css because I looked it up. Removing the element from the disk cache also removes the symptoms. Please find below the log trace of two requests for the same element style.css on the reverse proxy centuri:3080. The backend server is backend:7010. The two requests are separated by some CRs. [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(66): proxy: HTTP: canonicalising URL //centuri:3080/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] mod_proxy.c(416): Trying to run scheme_handler [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(1042): proxy: HTTP: serving URL http://centuri:3080/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(178): proxy: HTTP connecting http://centuri:3080/html/styles.css to centuri.gsi.fr:3080 [Mon Jun 07 08:48:57 2004] [debug] proxy_util.c(1160): proxy: HTTP: fam 2 socket created to connect to centuri [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(327): proxy: socket is connected [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(361): proxy: connection complete to 150.175.10.189:3080 (centuri) [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(344): cache: stale cache - test conditional [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(391): cache: nonconditional - no cached etag/lastmods - add cache_in and DECLINE [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(66): proxy: HTTP: canonicalising URL //backend:7010/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] mod_proxy.c(416): Trying to run scheme_handler [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(1042): proxy: HTTP: serving URL http://backend:7010/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(178): proxy: HTTP connecting http://backend:7010/html/styles.css to backend:7010 [Mon Jun 07 08:48:57 2004] [debug] proxy_util.c(1160): proxy: HTTP: fam 2 socket created to connect to backend [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(327): proxy: socket is connected [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(361): proxy: connection complete to backend:7010 (backend) [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(877): proxy: start body send [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(532): cache: running CACHE_IN filter [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(790): cache: Caching url: /html/styles.css [Mon Jun 07 08:48:57 2004] [info] mem_cache: Cached url: centuri/html/styles.css? [Mon Jun 07 08:48:57 2004] [debug] mod_headers.c(521): headers: ap_headers_output_filter() [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(936): proxy: end body send [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(877): proxy: start body send [Mon Jun 07 08:48:57 2004] [debug] mod_headers.c(521): headers: ap_headers_output_filter() [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(936): proxy: end body send [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(66): proxy: HTTP: canonicalising URL //centuri:3080/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] mod_proxy.c(416): Trying to run scheme_handler [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(1042): proxy: HTTP: serving URL http://centuri:3080/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(178): proxy: HTTP connecting http://centuri:3080/html/styles.css to centuri.gsi.fr:3080 [Mon Jun 07 08:48:57 2004] [debug] proxy_util.c(1160): proxy: HTTP: fam 2 socket created to connect to centuri [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(327): proxy: socket is connected [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(361): proxy: connection complete to 150.175.10.189:3080 (centuri) [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(344): cache: stale cache - test conditional [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(391): cache: nonconditional - no cached etag/lastmods - add cache_in and DECLINE [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(66): proxy: HTTP: canonicalising URL //backend:7010/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] mod_proxy.c(416): Trying to run scheme_handler [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(1042): proxy: HTTP: serving URL http://backend:7010/html/styles.css [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(178): proxy: HTTP connecting http://backend:7010/html/styles.css to backend:7010 [Mon Jun 07 08:48:57 2004] [debug] proxy_util.c(1160): proxy: HTTP: fam 2 socket created to connect to backend [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(327): proxy: socket is connected [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(361): proxy: connection complete to backend:7010 (backend) [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(877): proxy: start body send [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(532): cache: running CACHE_IN filter [Mon Jun 07 08:48:57 2004] [debug] mod_cache.c(790): cache: Caching url: /html/styles.css [Mon Jun 07 08:48:57 2004] [info] mem_cache: Cached url: centuri/html/styles.css? [Mon Jun 07 08:48:57 2004] [debug] mod_headers.c(521): headers: ap_headers_output_filter() [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(936): proxy: end body send [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(877): proxy: start body send [Mon Jun 07 08:48:57 2004] [debug] mod_headers.c(521): headers: ap_headers_output_filter() [Mon Jun 07 08:48:57 2004] [debug] proxy_http.c(936): proxy: end body send And the cache configuration: MCacheMaxObjectSize 10000 MCacheSize 70000 CacheEnable mem / CacheRoot /apache/cache CacheSize 150000 CacheEnable disk / If this bug only affects you when you have both disk and mem cache enabled, I say we should apply the patches above and make a new bug request for the mem+disk cacheing bug. I agree. I'll create a new bug report. Should the status of the present be changed to FIXED? This may also fix 30278. So I mark 30278 dependent on this bug. I just tested Apache 2.0.52. It seems to me like this problem does not exist in that version. Seems to still present in 2.0.52 on win32 Can you test on 2.0.54? I'm having similar issue with both 2.0.55 and SVN snapshot. It seems Apache fails to re-cache cachable content when mod_mem_cache is used (it doesn't happen with mod_cache + mod_disk_cache). I have posted report of my investigation to 30370 (I didn't notice this report existed when I posted) - does it explain the issue? Though patch isn't available yet, I was able to fix the issue with the workaround I described in the posting. - http://issues.apache.org/bugzilla/show_bug.cgi?id=30370 I recommend downloading 2.0.59 because older versions seem to be incomplete and not production-ready. If you a forced to run an older version of httpd then you can try compiling the 2.0.59 source code and just using the mod_cache.so and mod_disk_cache.so files: ./configure --prefix=/tmp/httpd-2.0.59 --enable-cache=shared --enable-disk- cache=shared --enable-mem-cache=shared make make install We are running 2.0.52 httpd with 2.0.59 mod_cache without any problems... Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd. As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd. If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question. If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with. Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated. |