Overview Description : Some css size are not good into httpd cache disk. Here my cache configuration : <IfModule mod_cache.c> <IfModule mod_disk_cache.c> CacheRoot /cacheproxy/CR844-Production-SSL CacheSize 100000 CacheEnable disk / CacheDirLevels 1 CacheDirLength 2 CacheMaxExpire 86400 CacheDefaultExpire 7200 CacheForceCompletion 100 </IfModule> </IfModule> And the results of my observations (we have 5 urls for the same file, because we use dispatching into url) : Normal size : 43648 bytes (43648 Jul 10 18:39 feuille.css) Into the Httpd cache disk (bytes) : The header Content-Length is always : 43648 Into the disk (size in bytes) : (we have only write the affinity) - /g1/ssl/css/feuille.css --> 25716 ===> KO - /g1_k/ssl/css/feuille.css --> 43648 ===> OK - /g1_l/ssl/css/feuille.css --> 43648 ===> OK - /g1_m/ssl/css/feuille.css --> 28476 ===> KO - /g1_n/ssl/css/feuille.css --> 43648 ===> OK Steps to Reproduce: This problem is not reproducible. Actual Results: The navigator show some page with css file not complete ==> Bad posting Expected Results: Good file size into disk cache Build Date & Platform: Apache 2.0.46 build on AIX 5.1 FP3, H70 server 64 bits, compiled with gcc 3.2.3, Apache 32 bits Additional Builds and Platforms: Apache 2.0.45 on AIX 5.2, p610 server 64 bits, compiled with XLC 6.0.0.5, Apache 64 bits
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.