Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accidentally manually removed default.realm file #6694

Closed
Oussa04 opened this issue Dec 17, 2019 · 3 comments
Closed

Accidentally manually removed default.realm file #6694

Oussa04 opened this issue Dec 17, 2019 · 3 comments

Comments

@Oussa04
Copy link

Oussa04 commented Dec 17, 2019

Goal

Just reuse my app ( under development ).

Actual Results

App crashes instantly.
This is the error Stack:
`2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI NewLocalRef called with pending exception java.lang.IllegalStateException: Object is no longer managed by Realm. Has it been deleted?
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at java.lang.RuntimeException io.realm.internal.InvalidRow.getStubException() (InvalidRow.java:188)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at java.lang.String io.realm.internal.InvalidRow.getString(long) (InvalidRow.java:89)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at java.lang.String io.realm.com_example_axelspring_data_HeadlineRealmProxy.realmGet$name() (com_example_axelspring_data_HeadlineRealmProxy.java:101)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at java.lang.String com.example.axelspring.data.Headline.toString() (Headline.kt:15)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at java.lang.String java.lang.String.valueOf(java.lang.Object) (String.java:2924)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.example.axelspring.MainActivity$initializeUi$1.onChanged(com.example.axelspring.data.Headline) (MainActivity.kt:36)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.example.axelspring.MainActivity$initializeUi$1.onChanged(java.lang.Object) (MainActivity.kt:18)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void androidx.lifecycle.LiveData.considerNotify(androidx.lifecycle.LiveData$ObserverWrapper) (LiveData.java:131)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void androidx.lifecycle.LiveData.dispatchingValue(androidx.lifecycle.LiveData$ObserverWrapper) (LiveData.java:149)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void androidx.lifecycle.LiveData.setValue(java.lang.Object) (LiveData.java:307)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.example.axelspring.utilities.RealmObjectLiveWrapper.access$setValue(com.example.axelspring.utilities.RealmObjectLiveWrapper, io.realm.RealmModel) (RealmObjectLiveWrapper.kt:8)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.example.axelspring.utilities.RealmObjectLiveWrapper$listener$1.onChange(io.realm.RealmModel) (RealmObjectLiveWrapper.kt:10)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.example.axelspring.utilities.RealmObjectLiveWrapper$listener$1.onChange(java.lang.Object) (RealmObjectLiveWrapper.kt:8)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.ProxyState$RealmChangeListenerWrapper.onChange(io.realm.RealmModel, io.realm.ObjectChangeSet) (ProxyState.java:50)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.OsObject$ObjectObserverPair.onChange(io.realm.RealmModel, io.realm.ObjectChangeSet) (OsObject.java:73)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.ProxyState$QueryCallback.onCalled(io.realm.internal.OsObject$ObjectObserverPair, java.lang.Object) (ProxyState.java:70)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.ProxyState$QueryCallback.onCalled(io.realm.internal.ObserverPairList$ObserverPair, java.lang.Object) (ProxyState.java:65)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.ObserverPairList.foreach(io.realm.internal.ObserverPairList$Callback) (ObserverPairList.java:109)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.ProxyState.notifyQueryFinished() (ProxyState.java:132)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.ProxyState.onQueryFinished(io.realm.internal.Row) (ProxyState.java:199)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.PendingRow.notifyFrontEnd() (PendingRow.java:248)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.PendingRow.access$000(io.realm.internal.PendingRow) (PendingRow.java:21)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.PendingRow$1.onChange(io.realm.internal.PendingRow) (PendingRow.java:49)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.PendingRow$1.onChange(java.lang.Object) (PendingRow.java:46)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.ObservableCollection$RealmChangeListenerWrapper.onChange(java.lang.Object, io.realm.OrderedCollectionChangeSet) (ObservableCollection.java:39)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.ObservableCollection$CollectionObserverPair.onChange(java.lang.Object, io.realm.internal.OsCollectionChangeSet) (ObservableCollection.java:20)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.ObservableCollection$Callback.onCalled(io.realm.internal.ObservableCollection$CollectionObserverPair, java.lang.Object) (ObservableCollection.java:64)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.ObservableCollection$Callback.onCalled(io.realm.internal.ObserverPairList$ObserverPair, java.lang.Object) (ObservableCollection.java:54)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.ObserverPairList.foreach(io.realm.internal.ObserverPairList$Callback) (ObserverPairList.java:109)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void io.realm.internal.OsResults.notifyChangeListeners(long) (OsResults.java:626)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:336)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void android.os.Looper.loop() (Looper.java:174)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7356)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:492)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:930)
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570]
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] in call to NewLocalRef
2019-12-17 04:03:34.102 12530-12530/com.example.axelspring A/mple.axelsprin: java_vm_ext.cc:570] from void android.os.MessageQueue.nativePollOnce(long, int)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] Runtime aborting...
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] Dumping all threads without mutator lock held
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] All threads:
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] DALVIK THREADS (19):
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] "main" prio=10 tid=1 Runnable
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | group="" sCount=0 dsCount=0 flags=0 obj=0x713c61f0 self=0xef837800
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | sysTid=12530 nice=-10 cgrp=default sched=0/0 handle=0xefe7bdc8
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | state=R schedstat=( 446482200 262675941 277 ) utm=29 stm=15 core=1 HZ=100
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | stack=0xff459000-0xff45b000 stackSize=8192KB
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | held mutexes= "abort lock" "mutator lock"(shared held)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] native: #00 pc 00493b03 /apex/com.android.runtime/lib/libart.so (art::DumpNativeStack(std::*1::basic_ostream<char, std::*1::char_traits>&, int, BacktraceMap_, char const_, art::ArtMethod_, void_, bool)+115)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] native: #1 pc 005b1f62 /apex/com.android.runtime/lib/libart.so (art::Thread::DumpStack(std::*1::basic_ostream<char, std::1::char_traits>&, bool, BacktraceMap, bool) const+994)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] native: #2 pc 005acdf1 /apex/com.android.runtime/lib/libart.so (art::Thread::Dump(std::1::basic_ostream<char, std::1::char_traits>&, bool, BacktraceMap, bool) const+65)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] native: #3 pc 005d2c61 /apex/com.android.runtime/lib/libart.so (art::DumpCheckpoint::Run(art::Thread
)+929)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] native: #4 pc 005cab96 /apex/com.android.runtime/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure_, art::Closure_)+486)
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | state=S schedstat=( 40980 5026357 1 ) utm=0 stm=0 core=0 HZ=100
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | stack=0xc5bb3000-0xc5bb5000 stackSize=1040KB
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] | held mutexes=
2019-12-17 04:03:34.339 12530-12530/com.example.axelspring A/mple.axelsprin: runtime.cc:630] kernel: (couldn't read /proc/self/task/12544/stack)

beginning of crash
2019-12-17 04:03:34.340 12530-12530/com.example.axelspring A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 12530 (mple.axelspring), pid 12530 (mple.axelspring)`

Steps & Code to Reproduce

I accidentally manually removed .realm file. Now, each time I try to open my app it throws an exception.
I tried basically everything to make it work again, but nothing.
I deleted the app, removed the folder /data/data/com.exemple.package

Version of Realm and tooling

Realm version(s): 6.0.1

Realm Sync feature enabled: No

Android Studio version: 3.5.3

Which Android version and device(s): PIXEL 3 API 29 Emulator.

@cmelchior
Copy link
Contributor

Well, removing the file under the apps feet while running is usually not going to end well.
In this case, though, it looks like the Realm part of the code recovered. The exception you are getting started here at java.lang.String com.example.axelspring.data.Headline.toString() (Headline.kt:15) Which then crashes because the element has been deleted (which it has, if you removed the file). So it looks like you have some parts of your code assuming that the object is always present.

@Oussa04
Copy link
Author

Oussa04 commented Dec 20, 2019

Yes, exactly. Realm.init() works initiating the database I guess but the rest of the code doesn't query the new reference of the database; instead it's looking for the old one which has been removed.

@RealmBot RealmBot changed the title Accidentally manually removed default.realm file Accidentally manually removed default.realm file Apr 6, 2020
@cmelchior
Copy link
Contributor

Closing as outdated. If this is still an issue, feel free to reopen.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants