httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
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

           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

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. */
            /* 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

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message