logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Caching Errors running on Windows XP
Author
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Thu 05 Mar '09 14:18    Post subject: Caching Errors running on Windows XP Reply with quote

Hi there.

I’m running Apache 2.2.11 (on Windows XP) as a reverse caching proxy situated at the edge of the local network, but I keep getting the following warning:

(OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed:

I don’t believe the error is generated for every cache access, but it is relatively common. This error is reproducible whether Apache is run as a service or a console app. I’ve googled the problem and, although the only suggestions I’ve seen are :
- That the problem is caused by incorrect Apache rights (not a problem in this case)
- That a statement is required in httpd.conf to allow users access to the cache (added this, but it makes no difference).

Has anyone successfully solved this problem?
Relevant sections of my httpd.conf are included below.

Thanks
Dave
Code:
 # Set access rights for cache. 
<Directory "C:/Apache22/cacheroot">
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
 
<IfModule mod_cache.c>
  # Dont cache cookies
  CacheIgnoreHeaders Set-Cookie
   
  # Don't cache local files or security updates
  CacheDisable http://security.update.server/update-list/
  CacheDisable http://192.168.0.110/
 
  #LoadModule disk_cache_module modules/mod_disk_cache.so
  # Following config relates to a disk cache - memory cache maybe used instead
  <IfModule mod_disk_cache.c>
    CacheRoot c:/Apache22/cacheroot
    CacheEnable disk /
    CacheDirLevels 5
    CacheDirLength 3
    CacheMaxFileSize 501024
  </IfModule>
</IfModule>
Back to top
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Thu 05 Mar '09 16:34    Post subject: Reply with quote

OK, I've done more testing on both dual and quad core machines and found I can repoduce the problem quite well - typically getting an error reported for between 10-30% of cache hits.

However, I can ONLY reproduce the problem with debug builds. When build as release no warnings are generated. I guess this is a good thing, but is something to be aware of when developing.

Dave
Back to top
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Thu 05 Mar '09 17:03    Post subject: Reply with quote

Sorry - false alarm! I am still getting error messages when running in release mode!
Back to top
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Fri 06 Mar '09 16:27    Post subject: Reply with quote

OK - it seems that my problem must relate to the way I build Apache, as I when I download and run a Windows binary the errors do not appear.

I am building Apache with Visual Studio 2008.

Dave


The steps I have used to build Apache are outlined below:
1. Download Windows version of awk from http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe. Rename this to awk.exe and place where the system path will find it.
2. If not installed, download perl and ensure perl/bin is added to the system path.
3. Download apache source – from one of the mirrors – eg http://mirrors.dedipower.com/ftp.apache.org/httpd/ and extract to folder – I’ll use c:\code\apache for this example.
4. Download zlib source from http://zlib.net/ and extract to c:\code\apache\ srclib\zlib.
5. Open c:\code\apache \srclib\zlib\projects\visualc6\zlib.dsw, clicking “yes” to the prompts to convert.
6. Right click on "zlib" in Solution Explorer and select Properties, configuration manager and select Lib Release.
7. Select build->build zlib. Program may need to be built twice before it will be ok.
8. Close the project and copy
c:\code\apache\srclib\zlib\projects\visualc6\Win32_LIB_Release\zlib.lib
(or ... Win32_DLL_ASM_Debug\zlib1d.lib if debugging) to c:\code\apache\srclib\zlib\zlib.lib
9. I’ve read reports of some people needing to fix line endings in the dsp/dsw files. This is not something I found – it may have been fixed by now or maybe the de-compression utility I used (jzip) automatically corrected this. The fix is to run the following :
zip -R dsps.zip *.dsp *.dsw
unzip -a -o dsps.zip
10. The Apache .dsp project files are distributed in Visual C++ 6.0 format. However a VS bug incorrectly parses these files. To fix the problem run the following
srclib\apr\build\cvtdsp.pl -2005
11. Apache.dsw with VS8/VS9 and answer "Yes to All" to the "convert projects" question.
12. Close the Apache.dsw solution in VS8/VS9 and open Apache.sln
13. The interesting modules are BuildBin and InstallBin (which generates a load of other files, such as documentation).
Open BuildBin properties then
- select Release configuration.
- go to mod_ssl and deselect from the build.
14. From solution explorer, right click on mod_deflate properties. Select Linker->Input and check that the zlib.lib is shown. (Mine originally had zlll.lib).
15. The Configuration Properties-> NMake Command Line settings contain the install directory. This is \Apache22 by default but can be changed.
16. Right click on BuildBin and select Build. There are some dependency issues so this build is likely to fail but should complete successfully at the second or third attempt should.
17. A linker warning is generated as the linker /MACHINE option is not specified in the Apache project files, but the default "X86" is the value you want unless you are building for 64-bit Windows.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 06 Mar '09 17:26    Post subject: Reply with quote

I see a lot of may need to build 2 or 3 times .. WTF?

For me the build chokes on apr_dbd_odbc.lib, so I build installbin till it ends knowing full well I am going to see a bunch of errors at the end. Then I build manually

apr_dbd_odbc
apr_dbd_mysql (cause I have it)
mod_deflate
mod_ssl
abs

then run installbin again. It finished with ab and then fills the install folders with the exception of apr_dbd_mysql.

I personally believe in my case that build chokes on apr_dbd because of a configuration error on my machine. Apache 2.2.10 which did not build the odbc driver by default built without a hitch.

I also do not know of any "dependency issues" which is mentioned here.

BTW, VS9 is basically barely supported and the folks over at ASF scoff at IDE builds currently. Now, here is the command line way to do it all thanks to our good friend Tom, give it a try.

http://wiki.apache.org/httpd/Win32VC9Build

Two things, you do not need the Server 2008 SDK and you just use the VC++ console in XP's VS9 start menu.
Back to top
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Mon 09 Mar '09 17:59    Post subject: Reply with quote

OK. I've gone back to the start.

I get the "(OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed" error no matter what I try.

I've downloaded the 2.2.11 binary, and built 2.2.10 and 2.2.11 from both the command line and the Visual Studio (2008).

Yet I still get this error.

I’ve been trying to get some repeatability by repeating the following:
- Clear the Apache cache and browser cache;
- visiting 4 web pages in turn;
- clear the browser cache;
- visit the same 4 web sites;
- check for errors.

The access log typically shows about 645 entries in each test, whilst the error log will record 30 to 35 errors. I’ve been testing this using two PCs – one for Apache and a second to browse from.

Altering the cache structure (i.e. length of directory names and cache depth) makes no difference to the number of errors reported.

It is not the same files causing the error, or even the same type of file (I’ve seen js, css, gif, jpg).

A typical listing from the error log (with debug) would be:
[Mon Mar 09 15:44:56 2009] [debug] mod_cache.c(639): cache: Caching url: http://www.channel4.com/4od/media/hp/june2008/f_word_fsh.jpg
[Mon Mar 09 15:44:56 2009] [debug] mod_cache.c(645): cache: Removing CACHE_REMOVE_URL filter.
[Mon Mar 09 15:44:56 2009] [debug] mod_disk_cache.c(962): disk_cache: Stored headers for URL http://www.channel4.com:80/4od/media/hp/june2008/f_word_fsh.jpg?
[Mon Mar 09 15:44:56 2009] [warn] (OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed: c:/ApacheCache/aptmpZYOCu9 -> c:/ApacheCache/opxvp/v_EEk/nqiJm/fgFYe9A.data
[Mon Mar 09 15:44:56 2009] [debug] mod_disk_cache.c(1051): disk_cache: Body for URL http://www.channel4.com:80/4od/media/hp/june2008/f_word_fsh.jpg? cached.

This problem seems so repeatable in the last two builds that I’m surprised more people haven’t been asking questions.

I’ve simplified the httpd.conf file as far as possible, and this is included this below.

Thanks for your suggestions
Dave


Code:
ServerRoot "C:/Apache22"

LoadModule authz_host_module modules/mod_authz_host.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so

DocumentRoot "C:/Apache22/htdocs"

<Directory />
  Options FollowSymLinks
  Order deny,allow
  Deny from all
</Directory>

Listen 80
ProxyRequests On
<Proxy *>
   Order Deny,Allow
   Deny from all
   Allow from 192.168.0
</Proxy>

<Directory "C:/ApacheCache">
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
 
CacheRoot c:/ApacheCache
CacheEnable disk /

<Directory "C:/Apache22/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

ErrorLog "c:/Apache22/logs/error.log"
LogLevel debug

LogFormat "%h %t \"%r\" %>s %B %X" common
CustomLog "logs/access.log" common

TypesConfig conf/mime.types
Back to top
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Wed 11 Mar '09 10:33    Post subject: Reply with quote

I now believe this is a maifestation of bug https://issues.apache.org/bugzilla/show_bug.cgi?id=38827, although I've had no success with the suggested "Header unset Vary" work around

The error occurs when Apache attempts to refresh a cached header, resulting in an access denied warning. This is shown in the error log as:

cache_storage.c(272): Cached response for <url> isn't fresh.
Adding/replacing conditional request headers.
........
''''''''
(OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed


I have reproduced this on 2.2.10 and 2.2.11, using both the available binaries and by building (from IDE and command line) from scratch.


Dave
Back to top
jemrayfield



Joined: 12 Mar 2009
Posts: 2
Location: london

PostPosted: Thu 12 Mar '09 12:55    Post subject: mod_disk_cache : (OS 5)Access is denied Reply with quote

Hi,

has anyone found a solution to this?

(OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed


Nothing gets cached? I keep seeing the following errors:

[warn] (OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed: D:\\tools\\dev\\http\\apache\\cache/aptmpJvHqon -> D:\\tools\\dev\\http\\apache\\cache/RuP/Brw/W_X/GCQ/IMV/Ry0kDWg.data


Any thoughts/pointers greatly appreciated!


Here is my very simple config:
<Proxy balancer://tomcatBalancer>
BalancerMember http://localhost:8080
ProxySet lbmethod=bytraffic
ProxySet timeout=1
</Proxy>
ProxyTimeout 5

RewriteEngine On
RewriteRule ^/proxy/(.*) balancer://tomcatBalancer/$1 [P,QSA,L]

# Disk cache
# Set the permissions on the cache directory
<Directory "D:\tools\dev\http\apache\cache">
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<IfModule mod_cache.c>

# Dont cache cookies
CacheIgnoreHeaders Set-Cookie

# Specifics for Disck cache
# Cache proxy content on disk
<IfModule mod_disk_cache.c>
# URLs to cache
CacheEnable disk /proxy
CacheEnable disk /proxy/cacheExpire

# Cache iNode structure
CacheDirLevels 5
CacheDirLength 3

# Cache directory
CacheRoot D:\tools\dev\http\apache\cache
</IfModule>
</IfModule> Confused Confused
Back to top
jemrayfield



Joined: 12 Mar 2009
Posts: 2
Location: london

PostPosted: Thu 12 Mar '09 13:01    Post subject: Reply with quote

(Re-post with code tags)

Hi,

has anyone found a solution to this?

(OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed


Nothing gets cached? I keep seeing the following errors:

Code:

  [warn] (OS 5)Access is denied. : disk_cache: rename tempfile to datafile failed: D:\\tools\\dev\\http\\apache\\cache/aptmpJvHqon -> D:\\tools\\dev\\http\\apache\\cache/RuP/Brw/W_X/GCQ/IMV/Ry0kDWg.data



Any thoughts/pointers greatly appreciated!


Here is my very simple config:



Code:


<Proxy balancer://tomcatBalancer>
  BalancerMember http://localhost:8080
  ProxySet lbmethod=bytraffic
  ProxySet timeout=1
</Proxy>
ProxyTimeout 5

RewriteEngine On
RewriteRule ^/proxy/(.*) balancer://tomcatBalancer/$1 [P,QSA,L]

# Disk cache
# Set the permissions on the cache directory
<Directory "D:\tools\dev\http\apache\cache">
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

<IfModule mod_cache.c>

  # Dont cache cookies
  CacheIgnoreHeaders Set-Cookie

  # Specifics for Disck cache
  # Cache proxy content on disk
  <IfModule mod_disk_cache.c>
     # URLs to cache
     CacheEnable disk /proxy
     CacheEnable disk /proxy/cacheExpire

     # Cache iNode structure
     CacheDirLevels 5
     CacheDirLength 3

     # Cache directory
     CacheRoot D:\tools\dev\http\apache\cache
  </IfModule>
</IfModule>
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 12 Mar '09 19:02    Post subject: Reply with quote

ok this works for me but
I'm not running proxy
I'm running VC6 2.2.11 binary with
http://people.apache.org/~jim/patches/httpd-2.2-lbset.patch
http://people.apache.org/~lars/mod_deflate_etagfix.patch
http://people.apache.org/~lars/cacheignoreheaders-fix.patch

and then some so there is some apples and oranges there

Code:

LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so

<Directory "/usr/etc/tmp">
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

<IfModule mod_cache.c>

  CacheIgnoreHeaders Set-Cookie

  <IfModule mod_disk_cache.c>
     CacheEnable disk /
     CacheDirLevels 5
     CacheDirLength 4
     CacheRoot /usr/etc/tmp
  </IfModule>
</IfModule>


I have not been able to get that error message.

Interstingly, the comment in the function I find this error message in states

/* This assumes that the tempfile is on the same file system
* as the cache_root. If not, then we need a file copy/move
* rather than a rename.
*/

This is all well and fine, so why pollute the log with the rename functions error if you are just going to turn around, copy and move file? I don't get it!

Wha I do see right before this comment is a call to close the tempfile. Ok, so what stops us from renaming/deleting files? File locks (file in use) or doesn't exist. It seems possibly that the file is still in use when the rename is called and has not yet closed, or the file has already been removed by something else and doesn't exist. This is all theory mind you, I'm still trying to find a definitive common thread.

jemrayfield:
As for you, try doubling the backslashes \\ or change the backslashes to forward ones may help

here
<Directory "D:\tools\dev\http\apache\cache">

and here
CacheRoot D:\tools\dev\http\apache\cache
Back to top
dave-rv



Joined: 25 Feb 2009
Posts: 9

PostPosted: Mon 16 Mar '09 13:01    Post subject: Reply with quote

I’ve done a little more investigation to see if I can track down the problem.

I first disabled virus checking for the cache and also turned off all indexing services to eliminate any conflicts in this area, but this made no difference.

Next step was to load Process Monitor to see what that would tell me. Well, it does show the rejected attempts to rename files. A single thread is creating the file A, creating file B and then attempting to rename file B to A. I can’t see any definite problems, but have observed that the second file is created and then renamed without being closed. Could this be a problem?

I’m finding this problem simple to reproduce, but it obviously depends on a web site producing the suitable data. To generate the error, visit http://www.channel4.com/, clear the browser cache then refresh the web page.

Dave
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 16 Mar '09 17:41    Post subject: Reply with quote

IE6 & FF3 on WinXP

Best I could do was muster up a 404
68.183.49.73
netblock-68-183-49-73.dslextreme.com

Did I cause the particular error to be logged?
Search around 15:30-15:40 UTC
Back to top


Reply to topic   Topic: Caching Errors running on Windows XP View previous topic :: View next topic
Post new topic   Forum Index -> Apache