Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
See original GitHub issueWhat happened?
A fatal error occured when starting the App, can’t know exactly how or at what point, the error was logged on firebase and it doesn’t show much information about it, here are some logs about the crash that happened while doInBackground() was being executed:
Fatal Exception:
Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at com.reactnativecommunity.asyncstorage.SerialExecutor$1.run(SerialExecutor.java:25)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
What caused it:
Caused by java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/br.com.madeiramadeira/databases/RKStorage
at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1588)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1464)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1632)
at com.reactnativecommunity.asyncstorage.AsyncStorageModule$1.doInBackgroundGuarded(AsyncStorageModule.java:132)
at com.reactnativecommunity.asyncstorage.AsyncStorageModule$1.doInBackgroundGuarded(AsyncStorageModule.java:119)
at com.facebook.react.bridge.GuardedAsyncTask.doInBackground(GuardedAsyncTask.java:36)
at com.facebook.react.bridge.GuardedAsyncTask.doInBackground(GuardedAsyncTask.java:20)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.reactnativecommunity.asyncstorage.SerialExecutor$1.run(SerialExecutor.java:25)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Here we have some info about occurrences:

The issue is majorly happening on motorola devices and the logs are from a Samsung Galaxy J5 Prime running on Android 8.0.0
Version
@react-native-async-storage/async-storage: 1.16.2 react-native: 0.67.4
What platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
- web
System Information
System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Memory: 113.06 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
npm: 8.14.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 23, 26, 27, 28, 29, 30, 31, 32
Build Tools: 29.0.0, 29.0.2, 30.0.2, 30.0.3, 32.1.0
System Images: android-28 | Google Play Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-30 | Google Play Intel x86 Atom, android-32 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8092744
Xcode: 13.3/13E113 - /usr/bin/xcodebuild
Languages:
Java: 11.0.14 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.4 => 0.67.4
Steps to Reproduce
Unfortunately I don’t have any info on how to reproduce the error, just know it is happening at that function
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
java.lang.RuntimeException: An error occured while executing ...
You are running the AsyncTask like new MyAsyncTask().execute(); which means you are not passing any argument to it. But in doInBackground ...
Read more >An error occurred while executing doInBackground()
Hello i am following Udacity android data storage course.But just hit the wall. We are making pets app in witch user can add,update...
Read more >An error occurred while executing doInBackground(), java ...
I'm writing a Flutter/Android app that uses the RFIDAPI3Library, and it's base roughly off the SDK example app. It runs successfully when I ......
Read more >An error occured while executing doInBackground() at android ...
java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java) caused by: android.database.sqlite.
Read more >JobIntentService is crashing in an AsyncTask on Android 10 ...
Fatal Exception : java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399)
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Unfortunately wasn’t able to reproduce the error in any way you mentioned, I will try to apply the Next storage implementation on Android and hope it stops ocurring, anyway, can’t bring updates immediately but will try to see the results and update the thread
This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.