Re: cache_disk:error AH00708: Cannot open .data file, possible race condition
Rich Bowen <[email protected]> Tue, 28 Apr 2026 19:18:22 -0000
| Newsgroups | gmane.comp.apache.user |
|---|---|
| Message-ID | <[email protected]> |
Grace,
Thanks for the thorough writeup.
Your suspicion about a race condition is likely correct, and the overlay file=
system is almost certainly a contributing factor. OverlayFS has well-document=
ed timing issues where a file created in the upper layer may not be immediate=
ly visible to concurrent reads -- especially under heavy I/O. This would matc=
h your symptoms exactly: the .data file exists when you check after the fact,=
but wasn't visible at the instant the concurrent request tried to open it.
A couple of things to try:
Move the cache off the overlay filesystem. Mount a tmpfs or a bind-mounted vo=
lume for your CacheRoot instead:
# docker run ... -v /host/cache:/tmp/apache ...
# or in docker-compose:
volumes:
- type: tmpfs
target: /tmp/apache
If the error disappears, that confirms the overlay fs as the culprit.
CacheLock -- you're right that it only serializes cache updates (it's designe=
d to prevent the "thundering herd" problem where multiple requests try to ref=
resh the same expired entry simultaneously). It doesn't lock reads against co=
ncurrent writes, so it won't help here.
If the issue persists even on a non-overlay filesystem, it may be worth filin=
g a bug at https://bz.apache.org/bugzilla/ -- there could be a genuine race w=
indow between the .header and .data file creation in mod_cache_disk.
Hope that helps
--Rich
On 2026/04/27 17:18:09 wrote:
> Hi all, this is the error we have been seeing in our apache HTTP logs:
>=20
> [cache_disk:error] [pid 421298:tid 421362] (2)No such file or directory: [c=
lient [REDACTED_IP]] AH00708: Cannot open data file /tmp/apache/[HASH_PATH]/A=
A.data, referer: https://[REFERER_URL]
>=20
> When I check the cache, that file already exists and was created about the =
same time the error message was triggered. I believe the problem could be a r=
ace condition by .header being created before .data can be read from a slight=
ly earlier request, but I can=E2=80=99t prove this based on the file creation=
times which are rewritten after this error message is triggered and the cach=
e is rewritten. I have been unable to recreate this problem even by triggerin=
g a request with an extremely large .data file that takes longer than [mod_ca=
che: CacheLockMaxAge] to write
>=20
> I have ruled out the problem being that our cache is full and files can=E2=
=80=99t be written or htcacheclean being the problem by starting with a clean=
cache that begins to get these errors before it reaches its max size. I veri=
fied that I am getting multiple consecutive requests when I see this error
>=20
> Some information about our configuration:
>=20
> * cache.conf has CacheLock on
>=20
> * This only happens on our production environment which gets millions o=
f daily requests
>=20
> * I do not see any other relevant errors when I turn debug mode on
>=20
> * This is an infrequent error message, but it is reoccurring
>=20
> * We are using an overlay file system in a Docker container
>=20
> Has anyone encountered this issue before? I have not found an apache HTTP s=
etting to lock reading the cache, only writing the cache
>=20
>=20
> Thank you,
>=20
> Grace
>=20
>=20
>=20
>=20