You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vladimir Goncharov <vg...@ortv.ru> on 2002/02/06 16:19:03 UTC

mod_proxy cannot delete old cache file under Win32

Hello All,

mod_proxy cannot delete old cache file under Win32.

I use Apache 1.3.23 with mod_proxy under Win32 (Win2K Prof, Intel) compiled with MSVC 6 SP5.
Here is a fragment from httpd.conf
ProxyRequests           off
ProxyPass               /images/ http://www.ortv.ru/cache/img/
ProxyVia                off
CacheRoot               proxy
CacheSize               300000
CacheGcInterval         21
CacheLastModifiedFactor 0.01
You can find a full copy of my httpd.conf at the end of this message. 

Everything works perfectly when I send this request to httpd:
GET /images/20020205163724.GIF HTTP/1.1
Host: 127.0.0.1

The file requested is stored in cache (proxy/n/v/u/mrcterheykb0w5buhrrzg4h) and returned to the client.

This is http header for www.ortv.ru/cache/img/20020205163724.GIF (I think this is important and I'll describe it later). This file I request through mod_proxy.
HTTP/1.1 200 OK
Date: Wed, 06 Feb 2002 13:39:07 GMT
Server: Apache/1.3.23 (Win32) mod_plsql/3.0.9.8.3
Content-Length: 13013
Last-Modified: Tue, 05 Feb 2002 10:37:24 GMT
Expires: Sun, 07 Apr 2002 13:25:29 GMT
Cache-Control: max-age=5184000
X-ORACLE-CACHE-STATUS: HIT,EXPIRES
Connection: close
Content-Type: image/pjpeg.

Then I send another request:
GET /images/20020205163724.GIF HTTP/1.1
Cache-control: no-cache
Host: 127.0.0.1

As a response, I get a file, and the error log contains line like:
[error] (13)Permission denied: proxy: error deleting old cache file proxy/tmpa01796

And temporary file "proxy/tmpa01796".is not deleted.

I found this code starting at line 1696 of proxy_cache.c:
    if (unlink(c->filename) == -1 && errno != ENOENT) {
        ap_log_error(APLOG_MARK, APLOG_ERR, s,
                     "proxy: error deleting old cache file %s",
                     c->tempfile);
    } 
Which really means that we have problem with deleting file in the cache, not temporary file.

When I change this code to
    if (unlink(c->filename) == -1 && errno != ENOENT) {
        ap_log_error(APLOG_MARK, APLOG_ERR, s,
                     "proxy: error deleting old cache file %s (%s)",
                     c->tempfile, c->filename);
    } 
I get new line in httpd error log:
[error] (13)Permission denied: proxy: error deleting old cache file proxy/tmpa01688 (proxy/n/v/u/mrcterheykb0w5buhrrzg4h)

The file proxy/n/v/u/mrcterheykb0w5buhrrzg4h (and all directories) has all necessary privileges for user who runs Apache (really it has full control for Everyone) and no read-only attributes. The file system is NTFS.

As far as I understand from source code, the result of this error is that cache always stores obsolete files.

Also, I found that no errors appear in error log when http header of file to be cached looks like:
HTTP/1.1 200 OK
Date: Wed, 06 Feb 2002 14:21:44 GMT
Server: Apache/1.3.23 (Win32) mod_plsql/3.0.9.8.3
Cache-Control: max-age=86400
Expires: Thu, 07 Feb 2002 14:21:44 GMT
Last-Modified: Thu, 14 Oct 1999 15:05:42 GMT
ETag: "0-31e9-3805f146"
Accept-Ranges: bytes
Content-Length: 12777
Connection: close
Content-Type: image/gif

At this point I become confused and don't know where I must look for: Any help will be greatly appreciated.

The real reason to use mod_proxy is improving performance of my web server. I do it with ProxyPass directive that allows me to cache files that take long time to generate. The Web server this Apache works on gets 5-70 (average is 10) requests per second. In this message, all configuration files were heavily simplified to describe the problem.

Vladimir

The httpd.conf:
ServerType standalone
ServerRoot "c:/Apache"
PidFile logs/httpd.pid
ScoreBoardFile logs/apache_runtime_status
Timeout 90
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxRequestsPerChild 100000
ThreadsPerChild 542
LoadModule proxy_module modules/mod_proxy.so

ClearModuleList
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_mime.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_access.c
AddModule mod_proxy.c
AddModule mod_so.c


Port 85
ServerName 127.0.0.1
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
DirectoryIndex home.htm
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
TypesConfig conf/mime.types

DefaultType text/plain
ErrorLog logs\server_error.log

ProxyRequests           off
ProxyPass               /images/ http://www.ortv.ru/cache/img/
CacheRoot               proxy
CacheSize               300000
CacheGcInterval         21
CacheLastModifiedFactor 0.01