Bug 38827

Summary: mod_disk_cache trying to rename locked tempfile on 304 response
Product: Apache httpd-2 Reporter: dodger_web <dodger_web>
Component: mod_cache_disk / mod_disk_cacheAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED LATER    
Severity: regression CC: roel
Priority: P2 Keywords: FixedInTrunk
Version: 2.2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   

Description dodger_web 2006-03-02 10:11:45 UTC
When using mod_disk_cache in conjonction with mod_proxy, the mod_disk_cache 
failed to update his cache after a 304 response to backend request is received.

My configuration is as following:
- build apache based on sources http-2.2.0-win32-rev2 with MS VC++7
- having applied patch based on rev374931 (cache_storage. Without that it 
won't work.

- httpd.conf revelant parts:

CacheEnable disk /
CacheRoot "d:/somdir"
CacheDirLength 1
CacheDirLevels 1
CacheMaxExpire 604800
CacheDefaultExpire 604800
CacheLastModifiedFactor 2.0

SetEnvIf Request_URI "\.css$"  force-no-vary
SetEnvIf Request_URI "\.gif$"  force-no-vary
SetEnvIf Request_URI "\.hta$"  force-no-vary
SetEnvIf Request_URI "\.html$" force-no-vary
SetEnvIf Request_URI "\.jpg$"  force-no-vary
SetEnvIf Request_URI "\.js$"   force-no-vary
SetEnvIf Request_URI "\.vbs$"  force-no-vary

ProxyPass /dummy http://someserver/somedir/

- error.log:

[Wed Mar 01 17:55:04 2006] [debug] mod_cache.c(602): cache: Caching 
url: /dummy/somefile.htm
[Wed Mar 01 17:55:04 2006] [debug] mod_cache.c(608): cache: Removing 
CACHE_REMOVE_URL filter.
[Wed Mar 01 17:55:04 2006] [debug] mod_disk_cache.c(854): (OS 5)Access is 
denied.  : disk_cache: rename tempfile to varyfile failed: 
d:/somedir/aptmphDPPNj -> d:/somedir/K/dJOTUGmp@MAIPFjfsNpFA.header
[Wed Mar 01 17:55:04 2006] [debug] mod_cache.c(796): (OS 5)Access is 
denied.  : cache: store_headers failed
[Wed Mar 01 17:55:04 2006] [debug] mod_proxy_http.c(1530): proxy: end body send
[Wed Mar 01 17:55:04 2006] [debug] proxy_util.c(1769): proxy: HTTPS: has 
released connection for (*)
Comment 1 dodger_web 2006-03-02 14:33:27 UTC
Seems to be related to vary header set on cached page.

Adding this in httpd.conf does solve the problem.

"Header unset Vary"

But then, we're loosing the opportunity to control cache with VARY.

I did track the problem to this line of code in mod_disk_cache, line 851:

rv = safe_file_rename(conf, dobj->tempfile, dobj->hdrsfile,
                                  r->pool);

Seems to not be able to overwrite an existing file.
Comment 2 Eric Covener 2012-11-04 03:22:59 UTC
I think r1405494 in trunk resolves this.
Comment 3 Stefan Fritsch 2013-03-03 16:51:52 UTC
fixed in 2.4.4
Comment 4 Roel Schroeven 2013-04-02 11:46:50 UTC
Is this going to be fixed in 2.2 as well?
Comment 5 Eric Covener 2016-12-31 00:23:18 UTC
Closing out 2.2.x bugs, fixed in 2.4.4.