"Realm instance has been closed" exception on un-closed Realm
See original GitHub issue@cmelchior and @zhuinden recall quirky experiences with RealmCache
causing an open Realm to appear closed.
The issue arose, recently in #4641
This issue tracks identifying and fixing the bug
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
This Realm instance has already been closed, making it ...
IllegalStateException : This Realm instance has already been closed, making it unusable. But after this error if reload fragment all works fine.
Read more >This Realm instance has already been closed, making it ...
I open my realm instance at the application level and close it only when the user logs out of the app. Crash location:...
Read more >Instance closing. This Realm instance has already been ...
Problem: Exception: IllegalStateException: This Realm instance has already been closed, making it unusable. Description: I have Base DAO class for each ...
Read more >Realm (Realm 4.3.1) - MongoDB
Returns the current number of open Realm instances across all threads in current process that are ... Checks if the Realm instance has...
Read more >The things I've learned using Realm | by Gabor Varadi - Medium
getDefaultInstance ()) { // open Realm for thread // use realm } // realm is closed by try-with-resources. The one special case the...
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
Note, I don’t think it is related to the RealmCache, but to the activity lifecycle. If I remember correctly last I checked, it appeared that sometimes things like ListView/RecyclerView would get invalidated during
onDestroy()
which would force a redraw and then naturally crash since the Realm was closed and data not available. I did not get to the bottom of it though.@beeender so it is as if even though local instance is closed, then RealmResults is invalid even if global instance is open.