Closed tmbrbr closed 2 years ago
Enabling cache logging via the environment variables:
export MOZ_LOG=timestamp,cache2:5
export MOZ_LOG_FILE=./cache.with_ff_cache.log
./mach build
will spew a load of cache related output into the file. Screenshot shows a diff of the logs where the cache load is working (left, where cache files are imported from a working firefox) and where it fails (right). There seems to be an additional line in the logs and a different error code on reading:
The cache files themselves are stored in:
obj-tf-release/tmp/profile-default/cache2/entries
A comparison of cache entries shows that the cache files are not correctly written: the files are smaller and seem to be missing a big chunk of data:
In the hex dump of the cache files, the working version (right) has the same metadata much later in the file.
It appears that cache file reads are working fine (as are read/writes to the cache in memory), but file writing is somehow broken.
Next steps: explore cache files located here: https://github.com/SAP/project-foxhound/tree/main/netwerk/cache2
Another Screenshot showing the cache logs when starting with an empty cache (ie no files are present). Left is the foxhound logs, right is the same from normal firefox:
Again, the foxhound version returns value of 2 from CacheIndex::HasEntry()
.
Re-enabling the cache with this commit: aadbd74f4f61faba564400f2b6d3c11c5b38e464
Seems to fix the issue - pages are now rendered successfully with entries from the cache.
If the HTTP cache is enabled (as it is by default) there is some strange behavior when reloading web pages.
With caching enabled, it appears some of the resources are not reloaded properly. This can mean that the page isn't rendered properly (in the case of CSS) or the page doesn't load (e.g. for JavaScript).
If caching is disabled, then all the pages load normally.