https://issues.apache.org/bugzilla/show_bug.cgi?id=44696

           Summary: mod_cache sometimes serves old content despite having
                    fetched new content
           Product: Apache httpd-2
           Version: 2.2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_cache
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


There appears to be a race condition which can occur when many clients request
the same object at once.  If the object is in the cache, but expired, and a
newer version is available at the backend, the first client can get served the
old content with the timestamp of the new content.

Example: using Apache 2.2.8, with mod_cache and mod_disk_cache, suppose there's
a 3300000-byte file at /rand which has been downloaded and cached, but has now
expired.  Suppose at Thu, 27 Mar 2008 16:44:40 GMT the file is updated so that
it's now 2100000 bytes.

If a hundred requests are made for the file almost simultaneously:

for x in $(seq -w 00 99);
do (echo -e 'GET /rand HTTP/1.0\n\n' | nc localhost 8000 >response.$x &);
done

then the first few responses are:

response.00
--------------------------------------------
HTTP/1.1 200 OK
Date: Thu, 27 Mar 2008 16:44:45 GMT
Server: Apache/2.2.8 (Unix)
Last-Modified: Thu, 27 Mar 2008 16:44:40 GMT
ETag: "72c013-200b20-4496de6d7ae00"
Accept-Ranges: bytes
Content-Length: 2100000
Connection: close
Content-Type: text/plain

?tuX`i%DJ!X.....


response.01
--------------------------------------------
HTTP/1.1 200 OK
Date: Thu, 27 Mar 2008 16:44:45 GMT
Server: Apache/2.2.8 (Unix)
ETag: "72c013-200b20-4496de6d7ae00"
Accept-Ranges: bytes
Content-Length: 3300000
Last-Modified: Thu, 27 Mar 2008 16:44:40 GMT
Connection: close
Content-Type: text/plain

_qj*mB(3m(f.....


response.02
--------------------------------------------
HTTP/1.1 200 OK
Date: Thu, 27 Mar 2008 16:44:45 GMT
Server: Apache/2.2.8 (Unix)
ETag: "72c013-200b20-4496de6d7ae00"
Accept-Ranges: bytes
Content-Length: 2100000
Last-Modified: Thu, 27 Mar 2008 16:44:40 GMT
Connection: close
Content-Type: text/plain

?tuX`i%DJ!X.....


On this occasion the second request gets handled first (it appears first in the
access log) and is served the old 3300000-byte content from the cache, but with
the timestamp of the new content.
The other 99 requests are served the correct new 2100000-byte content.


-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to