Unawaited cache-hit metadata update can surface iOS SQLite errors as unhandled
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 68/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- dart
- 領域
- databases, mobile-dev
研究方向
Start in flutter_cache_manager/lib/src/cache_store.dart at CacheStore._getCacheDataFromDatabase and the unawaited _updateCacheDataInDatabase call. Review the repository updateOrInsert path, then create the isolated cache-hit test described in the issue with a failing update. Done means the metadata failure is observed or handled without an unhandled asynchronous exception while the cached file remains usable.
由索引模型根據 Issue 內容生成。
描述
🐛 Bug Report
An iOS production build reported an unhandled SqfliteDatabaseException while displaying a cached network image. SQLite returned code 14 ("unable to open database file") for an UPDATE cacheObject ... WHERE _id = ?. Sentry recorded handled: no via PlatformDispatcher.onError. Image URL, SQL arguments, and user/device identifiers are omitted.
This resembles #494. A distinct concern is the cache-hit path in CacheStore._getCacheDataFromDatabase: it calls _updateCacheDataInDatabase(data!) without awaiting or handling the returned Future. If that write fails, the error can escape independently of the image-loading error path. The call is still present on main: https://github.com/Baseflow/flutter_cache_manager/blob/main/flutter_cache_manager/lib/src/cache_store.dart#L120-L127
The reason iOS could not access the SQLite file in this event is unknown; this report focuses on the unhandled asynchronous update.
Expected behavior
A cache metadata write failure should not produce an unhandled asynchronous exception. The cache manager should handle or surface it through an observed error path while keeping a valid cached file usable where possible.
Reproduction steps
The device event was intermittent in production; I do not have a deterministic device reproduction. An isolated test could create a valid cached file and metadata record, make the repository's updateOrInsert throw, then call CacheStore.getFile after a memory-cache miss. The cache-hit metadata update's Future is currently left unobserved.
Observed stack excerpt:
wrapDatabaseException (sqflite_platform_interface/src/platform_exception.dart:12)
SqfliteDatabaseMixinExt._txnRawUpdateOrDelete (sqflite_common/src/database_mixin.dart)
BasicLock.synchronized (synchronized/src/basic_lock.dart)
SqfliteDatabaseMixin.txnSynchronized (sqflite_common/src/database_mixin.dart)
Configuration
Version: flutter_cache_manager 3.4.2; cached_network_image 4.0.0; sqflite_darwin 2.4.3+1
Platform:
- 📱 iOS 18.6.2
- 🤖 Android
Flutter 3.47.2 / Dart 3.13.2.
- 主要語言
- Dart
- 星號
- 814
- 分支
- 513
- 平均合併
- 28 分鐘
- 30 天內合併 PR
- 12
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Baseflow/flutter_cache_manager 的其他 Issue
-
JsonCacheInfoRepository: FormatException: Unexpected end of input (at character 1) ^可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
Baseflow/flutter_cache_manager#450 · 9 則留言 · 8 個 reaction ·
維護者通常 1 天內回覆
-
existsSync in CacheStore._removeCachedFile blocks the main isolate (ANR on Android)可能已有人在做 @yamashita-room-335 於 5 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 22/100
Baseflow/flutter_cache_manager#539 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 30/100
Baseflow/flutter_cache_manager#508 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 48/100
Baseflow/flutter_cache_manager#507 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 30/100
Baseflow/flutter_cache_manager#501 · 1 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
查看 Baseflow/flutter_cache_manager 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
AppFlowy-IO/AppFlowy#9075 ·
-
Paste asks for iOS paste permission because the default context menu ignores SystemContextMenu可能已有人在做 @dorklein 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
maheshj01/searchfield#267 ·
-
難度 2/5 1-3 小時 新手友好度 67/100
-
難度 2/5 1-3 小時 新手友好度 72/100
avdept/JellyBoxPlayer#375 ·
維護者通常 1 天內回覆
-
bug good first issue
難度 2/5 1-3 小時 新手友好度 82/100
basictech01/uniun#300 ·
維護者通常 1 天內回覆