Plüm, Rüdiger, VF-Group wrote:
Can you try with the following additional patch and a clean cache?
Afterwards there should only be very very few orphaned header files
left.:

Index: modules/cache/mod_disk_cache.c
===================================================================
--- modules/cache/mod_disk_cache.c      (revision 732705)
+++ modules/cache/mod_disk_cache.c      (working copy)
@@ -558,6 +558,8 @@
         str_to_copy = dobj->hdrsfile ? dobj->hdrsfile : dobj->datafile;
         if (str_to_copy) {
             char *dir, *slash, *q;
+            char *dot;
+            char *hdrs_file;

             dir = apr_pstrdup(p, str_to_copy);

@@ -586,6 +588,18 @@
                  }
                  slash = strrchr(q, '/');
                  *slash = '\0';
+                 /*
+                  * Check if we just deleted a vary directory. If we did, the
+                  * corresponding header file is of no use anymore. So delete
+                  * it.
+                  */
+                 dot = strrchr(slash + 1, '.');
+                 if (dot && (strcmp(dot + 1, CACHE_VDIR_SUFFIX) == 0)) {
+                     *dot = '\0';
+                     hdrs_file = apr_pstrcat(p, dir, "/", slash + 1,
+                                             CACHE_HEADER_SUFFIX, NULL);
+                     apr_file_remove(hdrs_file, p);
+                 }
             }
         }
     }

Regards

Rüdiger


Ok, I applied this patch, rebuilt httpd_proxy and am now running it. I disabled my scripts for cleaning up the orphaned .header files, but still run htcacheclean in non-daemon mode every 10 minutes. After a few hours, I can now see that there are still .header files being left without any .vary directory.

Something about the above patch is confusing to me - this applies to mod_disk_cache, but I didn't think that mod_disk_cache actually did any cleaning up of the cache. I thought that was all done in htcacheclean. Am I mistaken there? In any case, it seems that the orphaned .header files are being produced by the runs of htcacheclean, so surely any prospective fix should be for htcacheclean.c?

Thanks again for your time and effort, much appreciated.

Neil

Reply via email to