httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53767] htcacheclean deletes stale "vary" header files even if cache limits aren't reached
Date Fri, 24 Aug 2012 10:54:14 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53767

--- Comment #2 from andyh <andy.hutson+apache@gmail.com> ---
>From http://svn.apache.org/repos/asf/httpd/httpd/trunk/support/htcacheclean.c
(which is later than the one we're running, but I believe has the same issue);
looks like this is the section that's doing it:

        /* single data and header files may be deleted either in realclean
         * mode or if their modification timestamp is not within a
         * specified positive or negative offset to the current time.
         * this handling is necessary due to possible race conditions
         * between apache and this process
         */
        case HEADER:
            current = apr_time_now();
            nextpath = apr_pstrcat(p, path, "/", d->basename,
                                   CACHE_HEADER_SUFFIX, NULL);
            if (apr_file_open(&fd, nextpath, APR_FOPEN_READ | APR_FOPEN_BINARY,
                              APR_OS_DEFAULT, p) == APR_SUCCESS) {
                len = sizeof(format);
                if (apr_file_read_full(fd, &format, len,
                                       &len) == APR_SUCCESS) {
                    if (format == VARY_FORMAT_VERSION) {
                        apr_time_t expires;

                        len = sizeof(expires);

                        if (apr_file_read_full(fd, &expires, len,
                                               &len) == APR_SUCCESS) {
                            apr_finfo_t finfo;

                            apr_file_close(fd);

                            if (apr_stat(&finfo, apr_pstrcat(p, nextpath,
                                    CACHE_VDIR_SUFFIX, NULL), APR_FINFO_TYPE,
p)
                                    || finfo.filetype != APR_DIR) {
                                delete_entry(path, d->basename, nodes, p);
                            }
                            else if (expires < current) {
                                delete_entry(path, d->basename, nodes, p);
                            }

                            break;
                        }
                    }


Specifically, this part:
                            else if (expires < current) {
                                delete_entry(path, d->basename, nodes, p);
                            }

This seems to be deleting expired vary header files by design. But this breaks
CacheStaleOnError handling, as well as (but to a lesser extent) the
stale-while-revalidate function that CacheLock provides, for any resources that
vary.

Not sure if there's any reason to be deleting these header files? They'll get
deleted later on anyway, in purge(), if the cache is above limits. If there's
no other need, should these three lines simply be removed?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message