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

Crash due to a NoSuchTable exception #6767

Closed
denysowova opened this issue Sep 16, 2020 · 18 comments
Closed

Crash due to a NoSuchTable exception #6767

denysowova opened this issue Sep 16, 2020 · 18 comments
Assignees

Comments

@denysowova
Copy link

denysowova commented Sep 16, 2020

Goals

Our app has been crashing occasionally due to the NoSuchTable exception being thrown. Unfortunately we cannot reproduce the issue. We've tried updating to the latest Realm version multiple times, but it didn't help.

The exception backtrace on Crashlytics is as following:

Fatal Exception: realm::NoSuchTable
No such table exists Exception backtrace: 
0 Realm 0x00000001022f4790 _ZN5realm11NoSuchTableC1Ev + 60 
1 Realm 0x0000000102393a68 _ZNK5realm13ConstTableRef5checkEv + 116 
2 Realm 0x0000000102393ad4 _ZNK5realm13ConstTableRefptEv + 20 
3 Realm 0x0000000102300220 _ZN5realm11Transaction14import_copy_ofENS_13ConstTableRefE + 32 
4 Realm 0x00000001021d8130 _ZN5realm5QueryC2EPKS0_PNS_11TransactionENS_13PayloadPolicyE + 312 
5 Realm 0x00000001023005b4 _ZN5realm11Transaction14import_copy_ofERNS_5QueryENS_13PayloadPolicyE + 64
6 Realm 0x00000001020ec7d0 _ZN5realm5_impl15ResultsNotifier12do_attach_toERNS_11TransactionE + 64 
7 Realm 0x00000001020a5414 _ZN5realm5_impl18CollectionNotifier9attach_toENSt3__110shared_ptrINS_11TransactionEEE + 36 
8 Realm 0x00000001020d828c _ZN5realm5_impl16RealmCoordinator19run_async_notifiersEv + 856 
9 Realm 0x00000001020d7ed8 _ZN5realm5_impl16RealmCoordinator9on_changeEv + 24 
10 Realm 0x00000001020a9540 _ZN5realm5_impl20ExternalCommitHelper6listenEv + 204 
11 Realm 0x00000001020aa010 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm5_impl20ExternalCommitHelperC1ERNS8_16RealmCoordinatorEE3$_0EEEEEPvSE_ + 52 
12 libsystem_pthread.dylib 0x00000001b959d2c0 <redacted> + 128 
13 libsystem_pthread.dylib 0x00000001b959d220 _pthread_start + 44 
14 libsystem_pthread.dylib 0x00000001b95a0cdc thread_start + 4
Crashed: Realm notification listener
0  MyApp                        0x1008f8da4 FIRCLSProcessRecordAllThreads + 392 (FIRCLSProcess.c:392)
1  MyApp                        0x1008f9188 FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423)
2  MyApp                        0x1008ef980 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  MyApp                        0x1008eb5dc __FIRCLSExceptionRecord_block_invoke + 218 (FIRCLSException.mm:218)
4  libdispatch.dylib              0x1b93bd7d4 _dispatch_client_callout + 16
5  libdispatch.dylib              0x1b936bc1c _dispatch_lane_barrier_sync_invoke_and_complete + 56
6  MyApp                        0x1008ead74 FIRCLSExceptionRecord + 225 (FIRCLSException.mm:225)
7  MyApp                        0x1008eaa14 FIRCLSTerminateHandler() + 285 (FIRCLSException.mm:285)
8  libc++abi.dylib                0x1b8b4c838 std::__terminate(void (*)()) + 16
9  libc++abi.dylib                0x1b8b4c434 __cxa_rethrow + 144
10 Realm                        0x1020aa0bc void*std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >(void*) + 224
11 libsystem_pthread.dylib        0x1b959d2c0 _pthread_body + 128
12 libsystem_pthread.dylib        0x1b959d220 _pthread_start + 44
13 libsystem_pthread.dylib        0x1b95a0cdc thread_start + 4
com.apple.main-thread
0  libsystem_kernel.dylib         0x1b951b9d4 __ulock_wait + 8
1  libsystem_pthread.dylib        0x1b9594ddc _pthread_join$VARIANT$mp + 440
2  libc++.1.dylib                 0x1b8b33f90 std::__1::thread::join() + 32
3  Realm                          0x1020a9348 realm::_impl::ExternalCommitHelper::~ExternalCommitHelper() + 52
4  Realm                          0x1020dd1b4 std::__1::unique_ptr<realm::_impl::ExternalCommitHelper, std::__1::default_delete<realm::_impl::ExternalCommitHelper> >::reset(realm::_impl::ExternalCommitHelper*) + 28
5  Realm                          0x1020d6dbc realm::_impl::RealmCoordinator::~RealmCoordinator() + 144
6  Realm                          0x10209ae28 std::__1::shared_ptr<realm::_impl::CollectionNotifier>::~shared_ptr() + 64
7  Realm                          0x1021a9d34 realm::Realm::~Realm() + 144
8  Realm                          0x10209ae28 std::__1::shared_ptr<realm::_impl::CollectionNotifier>::~shared_ptr() + 64
9  libobjc.A.dylib                0x1b8b567cc object_cxxDestructFromClass(objc_object*, objc_class*) + 148
10 libobjc.A.dylib                0x1b8b666b8 objc_destructInstance + 68
11 libobjc.A.dylib                0x1b8b66720 object_dispose + 16
12 Realm                          0x10217ae6c -[RLMRealm dealloc] + 92
13 libobjc.A.dylib                0x1b8b71b9c (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 672
14 CoreFoundation                 0x1b9910d6c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
15 CoreFoundation                 0x1b9910670 __CFRunLoopDoBlocks + 272
16 CoreFoundation                 0x1b990bbdc __CFRunLoopRun + 2312
17 CoreFoundation                 0x1b990afb4 CFRunLoopRunSpecific + 436
18 GraphicsServices               0x1bbb0c79c GSEventRunModal + 104
19 UIKitCore                      0x1e616cc38 UIApplicationMain + 212
20 MyApp                        0x100760814 main + 15 (AppDelegate.swift:15)
21 libdyld.dylib                  0x1b93ce8e0 start + 4

Version of Realm and Tooling

Realm framework version: 5.3.2

Xcode version: 11.7

iOS version: 11.4.1, 12.4, 12.4.5, 12.4.6, 13.4.1, 13.5.1, 13.6, 13.6.1

Dependency manager + version: CocoaPods 1.9.3

@jsflax
Copy link
Contributor

jsflax commented Sep 16, 2020

@denysowova are you able to follow the stacktrace up to your app code? Having some sample code would help us in reproducing/debugging the issue.

@denysowova
Copy link
Author

@jsflax unfortunately no, we cannot find the exact place where the application crashes.
Our app has only one main workout model which contains collections of other smaller models, nothing crazy. When the user works out, we frequently write to Realm. After the workout is finished, we send this data to our backend and delete this workout object from Realm. So the workflow is very simple and we don't keep data in Realm for a long time.
These crashes started happening when we migrated to Swift 5 and Realm 5. Before that, with Swift 4 and Realm 4 we didn't have such problems.
What is interesting also, is that the app crashes mostly for the new users when they start their first workout, so at that point the database is empty.

@finnschiermer
Copy link

Matches this Core bug realm/realm-core#3761

@finnschiermer
Copy link

This happens because the transaction that we're importing an object from is no longer valid at the time import_copy_of is run.

@denysowova
Copy link
Author

@finnschiermer can you please explain how to reproduce this issue or provide any possible fixes for it?

@finnschiermer finnschiermer self-assigned this Sep 24, 2020
@finnschiermer
Copy link

finnschiermer commented Sep 24, 2020

@denysowova This points to a bug in the ObjectStore or in the SDK, and we're working on isolating it. we don't have a fix for it yet.

@finnschiermer
Copy link

We currently don't have enough data to fix this. Next release of realm-object-store will include a few asserts that may (or may not) be able to tell us more.

@borislav-pixely
Copy link

The latest crash from today (it has been happening quite often):

Fatal Exception: realm::NoSuchTable
No such table exists Exception backtrace: 0 Realm 0x0000000106478790 _ZN5realm11NoSuchTableC1Ev + 60 1 Realm
0x0000000106517a68 _ZNK5realm13ConstTableRef5checkEv + 116 2 Realm 0x0000000106517ad4 
_ZNK5realm13ConstTableRefptEv + 20 3 Realm 0x0000000106484220 
_ZN5realm11Transaction14import_copy_ofENS_13ConstTableRefE + 32 4 Realm 0x000000010635c130 
_ZN5realm5QueryC2EPKS0_PNS_11TransactionENS_13PayloadPolicyE + 312 5 Realm 0x00000001064845b4 
_ZN5realm11Transaction14import_copy_ofERNS_5QueryENS_13PayloadPolicyE + 64 6 Realm 0x00000001062707d0 
_ZN5realm5_impl15ResultsNotifier12do_attach_toERNS_11TransactionE + 64 7 Realm 0x0000000106229414 
_ZN5realm5_impl18CollectionNotifier9attach_toENSt3__110shared_ptrINS_11TransactionEEE + 36 8 Realm 
0x000000010625c28c _ZN5realm5_impl16RealmCoordinator19run_async_notifiersEv + 856 9 Realm 0x000000010625bed8 
_ZN5realm5_impl16RealmCoordinator9on_changeEv + 24 10 Realm 0x000000010622d540 
_ZN5realm5_impl20ExternalCommitHelper6listenEv + 204 11 Realm 0x000000010622e010 
_ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm5_impl
20ExternalCommitHelperC1ERNS8_16RealmCoordinatorEE3$_0EEEEEPvSE_ + 52 12 libsystem_pthread.dylib 
0x00000001eac56ca8 _pthread_start + 320 13 libsystem_pthread.dylib 0x00000001eac5f788 thread_start + 8
Crashed: Realm notification listener
SIGABRT ABORT 0x00000001cf62f98c
keyboard_arrow_up
0
MyApp
FIRCLSProcess.c - Line 392
FIRCLSProcessRecordAllThreads + 392
1
MyApp
FIRCLSProcess.c - Line 423
FIRCLSProcessRecordAllThreads + 423
2
MyApp
FIRCLSHandler.m - Line 34
FIRCLSHandler + 34
3
MyApp
FIRCLSException.mm - Line 218
__FIRCLSExceptionRecord_block_invoke + 218
4
libdispatch.dylib
_dispatch_client_callout + 20
5 arrow_drop_down
libdispatch.dylib
_dispatch_lane_barrier_sync_invoke_and_complete + 60
6
MyApp
FIRCLSException.mm - Line 225
FIRCLSExceptionRecord + 225
7
MyApp
FIRCLSException.mm - Line 285
FIRCLSTerminateHandler() + 285
arrow_right 8
libc++abi.dylib
std::__terminate(void (*)()) + 20
9
libc++abi.dylib
__cxa_rethrow + 148

@leemaguire
Copy link
Contributor

@borislav-pixely Can you tell us what version of Realm you are using and some context of how you are using Realm?

@jesusmateos1234
Copy link

Same problem. Realm 5.5.0

@jesusmateos1234
Copy link

#6916 similar issue

@tgoyne
Copy link
Member

tgoyne commented Dec 18, 2020

This is probably fixed by realm/realm-core#4234.

@denysowova
Copy link
Author

This is probably fixed by realm/realm-core#4234.

Thank you, hopefully it is fixed now. Will update with the next Realm release and see.

@Lucodalack
Copy link

Hey guys, do we have any update? I could see that the fix was merged in Realm-Core but has not been released with Realm-Cocoa yet. Do we have any milestone with it

@jsflax
Copy link
Contributor

jsflax commented May 11, 2021

@Lucodalack This has been fixed in version 10.x. We do not currently have plans to backport the fix. Would you be able to upgrade to the latest version of Realm and see if that removes the crash?

@sync-by-unito sync-by-unito bot closed this as completed Jun 2, 2021
@seidju
Copy link

seidju commented Jun 29, 2021

Hey everyone, we also start to having such issue, version of Realm was 10.4.0, then we updated it to the latest release, but no luck, app crashes at launch, only reinstall of the app can help to resolve it.
DB scheme didn't changes couple of month already.

Fatal Exception: realm::NoSuchTable No such table exists Exception backtrace: 0 Realm 0x0000000101ce01b0 _ZNK5realm5Group7ndx2keyEm + 360 1 Realm 0x0000000101ce0308 _ZNK5realm5Group15key2ndx_checkedENS_8TableKeyE + 224 2 Realm 0x0000000101df7230 _ZNK5realm5Table18get_opposite_tableENS_6ColKeyE + 120 3 Realm 0x0000000101e0acf4 _ZN5realm5_impl11TableFriend23get_opposite_link_tableERKNS_5TableENS_6ColKeyE + 36 4 Realm 0x0000000101d58d3c _ZNK5realm3Obj16get_target_tableENS_6ColKeyE + 40 5 Realm 0x0000000101f3a3c8 _ZN5realm7ResultsC2ENSt3__110shared_ptrINS_5RealmEEENS2_INS_14CollectionBaseEEENS_4util8OptionalINS_5QueryEEENS_14SortDescriptorE + 156 6 Realm 0x0000000101ee2b80 _ZNK5realm12object_store10Collection10as_resultsEv + 236 7 Realm 0x0000000101b5cd58 _ZN13RLMSchemaInfo25appendDynamicObjectSchemaENSt3__110unique_ptrIN5realm12ObjectSchemaENS0_14default_deleteIS3_EEEEP15RLM

@Kysiek
Copy link

Kysiek commented Jul 20, 2021

@seidju did you manage to resolve this issue? I have the same problem with the current version of the app after upgrading to the Realm 10.10.0. Only I have the logs from Crashlytics and dozen of people affected with it:

Fatal Exception: realm::NoSuchTable No such table exists Exception backtrace: 0 Realm 0x0000000104de1dcc _ZN5realm11NoSuchTableC1Ev + 52 1 Realm 0x0000000104de1f24 _ZNK5realm5Group15key2ndx_checkedENS_8TableKeyE + 224 2 Realm 0x0000000104eefb90 _ZNK5realm5Table18get_opposite_tableENS_6ColKeyE + 120 3 Realm 0x0000000104f0372c _ZN5realm5_impl11TableFriend23get_opposite_link_tableERKNS_5TableENS_6ColKeyE + 36 4 Realm 0x0000000104e55eac _ZNK5realm3Obj16get_target_tableENS_6ColKeyE + 40 5 Realm 0x0000000105033908 _ZN5realm7ResultsC2ENSt3__110shared_ptrINS_5RealmEEENS2_INS_14CollectionBaseEEENS_4util8OptionalINS_5QueryEEENS_14SortDescriptorE + 156 6 Realm 0x0000000104fdb868 _ZNK5realm12object_store10Collection10as_resultsEv + 244 7 Realm 0x0000000104c5e5f4 -[RLMFastEnumerator initWithBackingCollection:collection:classInfo:] + 204 8 Realm 0x0000000104c6f958 -[RLMManagedArray fastEnumerator] + 68 9 Realm 0x0000000104c5ed54 _Z16RLMFastEnumerateP22NSFastEnumerationStatemPU28objcproto17RLMFastEnumerable11objc_object + 76 10 libswiftFoundation.dylib 0x00000001a19c9bd0 $s10Foundation25NSFastEnumerationIteratorV4nextypSgyF + 180 11 RealmSwift 0x00000001056ff934 $s10RealmSwift11RLMIteratorV4nextxSgyF + 124 12 RealmSwift 0x00000001056d3b9c $s10RealmSwift4ListC6append9objectsInyqd___t7ElementQyd__RszSTRd__lF + 344 13 Appic 0x0000000102c67fb8 Appic + 5750712 14 Appic 0x0000000102821820 Appic + 1267744 15 libdispatch.dylib 0x000000019db78a84 DAF30062-4C85-3B92-B159-50602A0C9D97 + 10884 16 libdispatch.dylib 0x000000019db7a81c DAF30062-4C85-3B92-B159-50602A0C9D97 + 18460 17 libdispatch.dylib

@jsflax
Copy link
Contributor

jsflax commented Jul 20, 2021

@seidju @Kysiek your stack traces appear to be different than the ones from the original issue. Could you please open a new issue with these stack traces and ideally a code sample to help us debug this?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 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

10 participants