It seems that in some cases the filesystem file underlying an entry cached by LRUFileCache may be deleted while still in use.
Proposed scenario for this:
- Access to binary D1, which is put in the cache, and a File entry D1F1 is created for its path.
- Access to binary D2, which is put in the cache.
- But the cache is now full and so D1 is marked as to be removed, and becomes eligible for GC through Framework.trackFile as soon as D1F1 is not referenced anymore.
- Access to binary D1, which is refetched and reput in the cache, and a new File entry D1F2 is created for its path.
- The GC removes D1F1 therefore provoking the deletion of D1 on the filesystem.
- D1F2 now refers to a nonexistent file and the next access will throw FileNotFoundException.