Baseflow / Baseflow/flutter_cache_manager

DatabaseException(attempt to re-open an already-closed object)

Open
#427 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
809
Forks
510
Avg merge
6m
Merged PRs (30d)
1

Description

## 🐛 Bug Report
Getting DatabaseException(attempt to re-open an already-closed object
flutter_cache_manager(v3.3.0) is indirectly used in our app because we use CachedNetworkImageProvider to display images in our app

We get the following exception in our app from some of our customer devices. We do not have repro steps. We are using v3.3.0. flutter_cache_manager is indirectly used in our app because we use CachedNetworkImageProvider

`DatabaseException(attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/ourapp_bundle_removed/files/libCachedImageData.db) sql 'SELECT * FROM cacheObject WHERE key = ?' args [https://cdnimages.ourappdomain_removed.com/3fe587d7369f7f0784881...]
Stack trace:
#0 wrapDatabaseException (package:sqflite/src/exception_impl.dart:11)

#1 SqfliteDatabaseMixin.txnRawQuery. (package:sqflite_common/src/database_mixin.dart:559)

#2 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33)

#3 SqfliteDatabaseMixin.txnSynchronized (package:sqflite_common/src/database_mixin.dart:490)

#4 CacheObjectProvider.get (package:flutter_cache_manager/src/storage/cache_info_repositories/cache_object_provider.dart:110)

#5 CacheStore._getCacheDataFromDatabase (package:flutter_cache_manager/src/cache_store.dart:116)
`
### Expected behavior
This alert does not occur
### Reproduction steps
N/A
### Configuration
v3.3.0 of flutter_cache_manager
**Flutter Version:** 3.3.10

**Platform:**
- [ ] :iphone: iOS
- [ X] :robot: Android

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Android failure from CacheObjectProvider.get in package:flutter_cache_manager/src/storage/cache_info_repositories/cache_object_provider.dart:110 through CacheStore._getCacheDataFromDatabase at cache_store.dart:116 and the sqflite stack. Reproduce or isolate the closed-database condition despite the report having no reproduction steps; done means the exception no longer occurs during cache lookups.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, sqlite
Domain
databases, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.