httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49393] New: mod_cache doesn't remove previous entry when stale entry is replaced
Date Sun, 06 Jun 2010 14:18:34 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49393

           Summary: mod_cache doesn't remove previous entry when stale
                    entry is replaced
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_cache
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: minfrin@sharp.fm


When we have a cached-and-stale entry, and the entry is updated with a 200 OK,
mod_cache attempts to remove the old cached entity:

        else if (!r->header_only) {
            /* Oh, well.  Toss it. */
            cache->provider->remove_entity(cache->stale_handle);
            /* Treat the request as if it wasn't conditional. */
            cache->stale_handle = NULL;
            /*
             * Restore the original request headers as they may be needed
             * by further output filters like the byterange filter to make
             * the correct decisions.
             */
            r->headers_in = cache->stale_headers;
        }

remove_entity() just NULLs out the cache object, it does not remove the stale
file on disk. This creates a race condition where for a brief time, the headers
from the new entity exist alongside the body of the stale entry.

To work around this, remove_entity() should be replaced with remove_url().

To properly fix this on trunk, we need to relook at the format for the data
file. The data file needs to be linked to from the headers file, and the
headers file needs to be written after the data file is written. This removes
the race completely, and allows us to update the cache atomically. This is not
something that is likely to be backportable to v2.2 though, thus the workaround
first.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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