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

Open
#427 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

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) <asynchronous suspension> #1 SqfliteDatabaseMixin.txnRawQuery.<anonymous closure> (package:sqflite_common/src/database_mixin.dart:559) <asynchronous suspension> #2 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33) <asynchronous suspension> #3 SqfliteDatabaseMixin.txnSynchronized (package:sqflite_common/src/database_mixin.dart:490) <asynchronous suspension> #4 CacheObjectProvider.get (package:flutter_cache_manager/src/storage/cache_info_repositories/cache_object_provider.dart:110) <asynchronous suspension> #5 CacheStore._getCacheDataFromDatabase (package:flutter_cache_manager/src/cache_store.dart:116) <asynchronous suspension>

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:

  • 📱 iOS
  • [ X] 🤖 Android
Dominant language
Dart
Stars
810
Forks
510
Avg merge
2d 2h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Baseflow/flutter_cache_manager

All issues in Baseflow/flutter_cache_manager

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.