question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"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:closed
  • Created 6 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
cmelchiorcommented, May 16, 2017

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.

1reaction
Zhuindencommented, Aug 4, 2017

@beeender so it is as if even though local instance is closed, then RealmResults is invalid even if global instance is open.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found