flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

FileSystemException: Cannot delete file

Open juansoos opened this issue 1 year ago • 8 comments

Sentry keeps reporting issues in my app that looks like this:

FileSystemException: Cannot delete file, path = '/data/user/0/<PACKAGE>/cache/cacheKey/23c5a2c0-f0e3-11ec-8c0e-df065a5f9164.webp' (OS Error: No such file or directory, errno = 2)

Sentry specifies that the error occurs in cache_store.dart in CacheStore._removeCachedFile at line 190 within flutter_cache_manager

I do not know the cause, as I have been unable to recreate it. About two years ago this issue was reported, which I believe is associated with the problem.

We are using cached_network_image: 3.2.1 which inside uses flutter_cache_manager 3.3.0

juansoos avatar Jul 11 '22 20:07 juansoos

got this issue in my app too

chenbokun97 avatar Aug 10 '22 06:08 chenbokun97

Similarly, I also got an error. The version I am using is 3.2.2.

FileSystemException: FileSystemException: Cannot delete file, path = '/data/user/0/com.xxx.xxx/cache/libCachedImageData/1ac62930-29e4-11ed-bce3-81be1b9f6831.octet-stream' (OS Error: No such file or directory, errno = 2) It gave too many warnings before this error.

Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction

rulucay avatar Dec 02 '22 12:12 rulucay

I caught the exception while debugging, so:

  • Where the exception was thrown: image

  • The parent caller: image

It seems that after checking that the file exists… it got removed before removing it? 👀

danielgomezrico avatar Jan 04 '23 21:01 danielgomezrico

got this issue in my app too

1712916 avatar May 02 '23 11:05 1712916

Any update on this?

MattyBoy4444 avatar Jul 29 '23 15:07 MattyBoy4444

We are also seeing this

lukepighetti avatar Jul 31 '23 17:07 lukepighetti

I have the same issue. If there was a way to wrap the CacheStore with a version that logs and ignores the error (if the file is missing or already deleted, it should just skip it) that would be great.

Although it doesn't address the root cause, I think ignoring this particular exception would be ok. Although if the root issue is resolved, this should never happen, I think we can ignore the error.

I made a fork solution here: https://github.com/ddikman/flutter_cache_manager/blob/develop/flutter_cache_manager/lib/src/cache_store.dart#L190-L198

ddikman avatar Sep 12 '23 06:09 ddikman

FWIW, we have changed our cache policy from a time based(3d) to count based(1000) and stopped seeing this error. We would have liked a size based (25MB) option, but count based is a reasonable proxy. It should apply to most other applications as well ✌️

okmanideep avatar Sep 20 '23 05:09 okmanideep