Summary: | Bad file size in disk cache for large css files | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | sebastien gautrias <sebastien.gautrias> |
Component: | mod_cache | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | ruediger.pluem |
Priority: | P3 | Keywords: | PatchAvailable |
Version: | 2.0.51 | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | AIX | ||
Attachments: |
.header and .data files
Proposed Patch Patch for 2.0.51 |
Description
sebastien gautrias
2003-07-11 09:01:31 UTC
Created attachment 7239 [details]
.header and .data files
I guess my problem is the same. I use mod_disk_cache to cache static files delivered by Tomcat via mod_jk. Unfortunately you did not write if you are caching local files or remote files (delivered by mod_jk, mod_proxy or something similar). I noticed that when you abort the download of a file which should be cached and whos origin is on a remote server, the partly downloaded file gets cached. The second request for this file only delivers the partly cached file and thus leads to the problems described by you. In my case the problem showed up by incomplete jpg pictures. The reason for this behaviour can be found in mod_disk_cache. mod_disk_cache does not notice that a request has been aborted. I wrote a small patch (against 2.0.50) that drops the partly cached file if the connection has been aborted. Unfortunately the CacheForceCompletion of mod_cache is not implemented right now such that nearly completely downloaded files get lost for the cache. But this is better than delivering only parts of the files in the following requests. Created attachment 12516 [details]
Proposed Patch
Can you please test this in 2.0.51? Lots of fixes for mod_disk_cache were made. I checked this with 2.0.51 and it is only partially fixed. It should work with local files, but it does not work if the length of the content to be cached is unknown and the file is large as it is the case if you cache large dynamic content originally created by Tomcat. And this is what I am doing. I try to lower the load on the Tomcats by caching large files generated by Tomcat that are valid for some time via mod_cache on the webserver. The problem is that in this case we get to line 663 of mod_disk_cache.c as the condition in line 661 is true in any case (content written completely to file or only partially because the connection has been aborted). So this operation is handled as successful caching of the request in any case even if the content was only saved partially. Nevertheless the changes to mod_disk_cache provide an better environment now for the needed changes so I provide an updated version of my patch for 2.0.51. Created attachment 12847 [details]
Patch for 2.0.51
A variant of the 'patch for 2.0.51' has been committed to HEAD as modules/experimental/mod_disk_cache.c rev 1.64. Thanks! Backported to v2.0.53. |