facebook/fresco

Occasionally throws FileNotFoundException by reading files after inserting to main disk cache concurrently

Open

#2,382 opened on 2019年7月23日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)Java (17,072 stars) (3,750 forks)batch import
bughelp wanted

説明

For more details please refer to this repo including a detailed README and a runnable Android app: https://github.com/JuniperPhoton/FrescoFileNotFoundBug

Description

This is an issue on this situation:

Massively and concurrently fetching images from network and insert them into disk cache immediately, and then read the files on the same thread.

By saying Massively and concurrently I mean doing the work on every 50ms, please refer to MainActivity for more details.

The issue is that sometimes it throws java.io.FileNotFoundException on reading saved files by opening a FileInputStream, even if the files do exist. The files can still be found using Android Studio's Device File Explorer can of course be opened.

Furthermore, if you try to open the file exported by content:// by other apps, or do a thread sleeping before accessing them, it will work.

Reproduction

Please refer to this repo: https://github.com/JuniperPhoton/FrescoFileNotFoundBug

Solution

Please refer to this repo: https://github.com/JuniperPhoton/FrescoFileNotFoundBug

Additional Information

  • Fresco version: 2.0.0
  • Platform version: No devices or OS version specified, tested on Android P/Q, Pixel 2 and OnePlus 7 Pro

コントリビューターガイド

Occasionally throws FileNotFoundException by reading files after inserting to main disk cache concurrently · facebook/fresco#2382 | Good First Issue