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 when initializing Realm #7777

Closed
ayush-ttn opened this issue Apr 29, 2022 · 9 comments
Closed

Crash when initializing Realm #7777

ayush-ttn opened this issue Apr 29, 2022 · 9 comments

Comments

@ayush-ttn
Copy link

ayush-ttn commented Apr 29, 2022

How frequently does the bug occur?

Sometimes

Description

So this crash is happening for some of our users at the app launch. We are yet to reproduce it on our side. The getter where the app is crashing is written like so:
var realm: Realm { return try! Realm() }
The strange part about this crash is, that it is happening for some users regardless of their devices or OS versions. One point to mention is, that we were getting a crash, that is reported here and to try to fix this we rolled back our realm version from 10.24 to 10.20 but the crash is still the same. Any help or guidance in this issue will be very much appreciated.

Stacktrace & log output

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0


Kernel Triage:
VM - Compressor failed a blocking pager_get


Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001de869b78 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000002184d83bc pthread_kill + 268 (pthread.c:1668)
2   libsystem_c.dylib             	0x00000001b1e8451c abort + 168 (abort.c:118)
3   Realm                         	0x00000001029066a0 realm::util::terminate+ 3106464 (char const*, char const*, long) + 0
4   Realm                         	0x00000001029069a0 realm::util::terminate_internal+ 3107232 (std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 328
5   Realm                         	0x0000000102906b18 realm::util::terminate+ 3107608 (char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 328
6   Realm                         	0x000000010278c650 realm::Cluster::init+ 1558096 (realm::MemRef) + 368
7   Realm                         	0x000000010279b25c realm::ClusterTree::create_root_from_parent+ 1618524 (realm::ArrayParent*, unsigned long) + 508
8   Realm                         	0x000000010279b5b0 realm::ClusterTree::init_from_parent+ 1619376 () + 36
9   Realm                         	0x00000001028bee80 realm::Table::init+ 2813568 (unsigned long, realm::ArrayParent*, unsigned long, bool, bool) + 204
10  Realm                         	0x00000001027bf4ec realm::Group::create_table_accessor+ 1766636 (unsigned long) + 804
11  Realm                         	0x00000001027bf16c realm::Group::do_get_table+ 1765740 (unsigned long) + 96
12  Realm                         	0x00000001028bd4e4 realm::Table::get_opposite_table+ 2807012 (realm::ColKey) const + 132
13  Realm                         	0x00000001028c8a1c realm::Table::get_link_target+ 2853404 (realm::ColKey) + 12
14  Realm                         	0x00000001029ebfe8 realm::ObjectSchema::ObjectSchema+ 4046824 (realm::Group const&, realm::StringData, realm::TableKey) + 1012
15  Realm                         	0x00000001029f4ba8 realm::ObjectStore::schema_from_group+ 4082600 (realm::Group const&) + 120
16  Realm                         	0x0000000102a52820 realm::Realm::read_schema_from_group_if_needed+ 4466720 () + 132
17  Realm                         	0x0000000102a525c8 realm::Realm::Realm+ 4466120 (realm::Realm::Config, realm::util::Optional<realm::VersionID>, std::__1::shared_ptr<realm::_impl::RealmCoordinator>, realm::Realm::MakeSharedTag) + 372
18  Realm                         	0x00000001029c1128 realm::Realm::make_shared_realm+ 3871016 (realm::Realm::Config, realm::util::Optional<realm::VersionID>, std::__1::shared_ptr<realm::_impl::RealmCoordinator>) + 180
19  Realm                         	0x00000001029c038c realm::_impl::RealmCoordinator::do_get_realm+ 3867532 (realm::Realm::Config, std::__1::shared_ptr<realm::Realm>&, realm::util::Optional<realm::VersionID>, realm::util::CheckedUniqueLock&) + 436
20  Realm                         	0x00000001029c0044 realm::_impl::RealmCoordinator::get_realm+ 3866692 (realm::Realm::Config, realm::util::Optional<realm::VersionID>) + 400
21  Realm                         	0x0000000102a53054 realm::Realm::get_shared_realm+ 4468820 (realm::Realm::Config) + 120
22  Realm                         	0x000000010273df98 +[RLMRealm realmWithConfiguration:queue:error:] + 956 (RLMRealm.mm:476)
23  RealmSwift                    	0x00000001030c748c specialized @nonobjc RLMRealm.__allocating_init(configuration:queue:) + 40 (<compiler-generated>:0)
24  RealmSwift                    	0x00000001030c748c @nonobjc RLMRealm.__allocating_init(configuration:queue:) + 40 (<compiler-generated>:0)
25  RealmSwift                    	0x00000001030c748c Realm.init(queue:) + 104 (Realm.swift:76)
26  Stitcher                      	0x000000010075cd30 DB.realm.getter + 12 (Database.swift:187)
27  Stitcher                      	0x000000010075cd30 DB.getAutoDownloadCandidates() + 12 (Database.swift:753)
28  Stitcher                      	0x000000010075cd30 protocol witness for DBProtocol.getAutoDownloadCandidates() in conformance DB + 12 (<compiler-generated>:752)
29  Stitcher                      	0x000000010075cd30 specialized LibraryRepository.init(db:network:downloadManager:) + 696 (LibraryRepository.swift:98)
30  Stitcher                      	0x000000010075db18 specialized LibraryRepository.init(db:network:downloadManager:) + 20 (<compiler-generated>:87)
31  Stitcher                      	0x000000010075db18 specialized LibraryRepository.init(db:network:downloadManager:) + 20 (<compiler-generated>:87)
32  Stitcher                      	0x000000010075db18 specialized LibraryRepository.init(db:network:downloadManager:) + 20 (<compiler-generated>:87)
33  Stitcher                      	0x000000010075db18 LibraryRepository.init(db:network:downloadManager:) + 20 (LibraryRepository.swift:87)
34  Stitcher                      	0x000000010075db18 specialized LibraryRepository.__allocating_init(db:network:downloadManager:) + 20 (<compiler-generated>:87)
35  Stitcher                      	0x000000010075db18 LibraryRepository.__allocating_init(db:network:downloadManager:) + 20 (<compiler-generated>:0)
36  Stitcher                      	0x000000010075db18 specialized StitcherCore.init(db:network:user:downloadManager:settingsManager:) + 1108
37  Stitcher                      	0x000000010075ea4c specialized StitcherCore.init(db:network:user:downloadManager:settingsManager:) + 28 (<compiler-generated>:0)
38  Stitcher                      	0x000000010075ea4c StitcherCore.init(db:network:user:downloadManager:settingsManager:) + 28 (StitcherCoreInterface.swift:178)
39  Stitcher                      	0x000000010075ea4c specialized StitcherCore.__allocating_init(db:network:user:downloadManager:settingsManager:) + 28 (<compiler-generated>:178)
40  Stitcher                      	0x000000010075ea4c StitcherCore.__allocating_init(db:network:user:downloadManager:settingsManager:) + 28 (AppDelegate.swift:79)
41  Stitcher                      	0x000000010075ea4c specialized AppDelegate.application(_:willFinishLaunchingWithOptions:) + 1812
42  Stitcher                      	0x0000000100758efc @objc AppDelegate.application(_:willFinishLaunchingWithOptions:) + 144
43  UIKitCore                     	0x00000001a949df00 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 204 (UIApplication.m:2323)
44  UIKitCore                     	0x00000001a9684da4 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3572 (UIApplication.m:2754)
45  UIKitCore                     	0x00000001a966d958 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1180 (UIApplication.m:4491)
46  UIKitCore                     	0x00000001a94cb590 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 152 (_UISceneLifecycleMultiplexer.m:450)
47  UIKitCore                     	0x00000001a9325c44 _UIScenePerformActionsWithLifecycleActionMask + 104 (_UISceneLifecycleState.m:109)
48  UIKitCore                     	0x00000001a94505ec __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216 (_UISceneLifecycleMultiplexer.m:563)
49  UIKitCore                     	0x00000001a9570380 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 380 (_UISceneLifecycleMultiplexer.m:515)
50  UIKitCore                     	0x00000001a97aefa4 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 772 (_UISceneLifecycleMultiplexer.m:562)
51  UIKitCore                     	0x00000001a973a554 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 340 (_UISceneLifecycleMultiplexer.m:468)
52  UIKitCore                     	0x00000001a9326a30 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 196 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:73)
53  UIKitCore                     	0x00000001a93e6934 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 892 (BSAnimationSettings+UIKit.m:50)
54  UIKitCore                     	0x00000001a9328934 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 276 (_UISceneSettingsDiffAction.m:23)
55  UIKitCore                     	0x00000001a9412aa0 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 384 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:58)
56  UIKitCore                     	0x00000001a9897564 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.615 + 776 (UIScene.m:1825)
57  UIKitCore                     	0x00000001a9356d14 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 256 (UIScene.m:1526)
58  UIKitCore                     	0x00000001a939a528 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 288 (UIScene.m:1792)
59  UIKitCore                     	0x00000001a94d0394 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 584 (UIApplication.m:3955)
60  UIKitCore                     	0x00000001a9410d64 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 388 (UIApplicationSceneClientAgent.m:45)
61  FrontBoardServices            	0x00000001b8f20294 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 440 (FBSScene.m:439)
62  FrontBoardServices            	0x00000001b8f46090 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.215 + 128 (FBSWorkspaceScenesClient.m:384)
63  FrontBoardServices            	0x00000001b8f01308 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240 (FBSWorkspace.m:352)
64  FrontBoardServices            	0x00000001b8f02958 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 372 (FBSWorkspaceScenesClient.m:383)
65  libdispatch.dylib             	0x00000001a6a08a2c _dispatch_client_callout + 20 (object.m:560)
66  libdispatch.dylib             	0x00000001a6a0c4e0 _dispatch_block_invoke_direct + 264 (queue.c:501)
67  FrontBoardServices            	0x00000001b8f02c70 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48 (FBSSerialQueue.m:157)
68  FrontBoardServices            	0x00000001b8f02040 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220 (FBSSerialQueue.m:181)
69  FrontBoardServices            	0x00000001b8f06700 -[FBSSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:194)
70  CoreFoundation                	0x00000001a6dc3f04 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1972)
71  CoreFoundation                	0x00000001a6dd4c90 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016)
72  CoreFoundation                	0x00000001a6d0e1e8 __CFRunLoopDoSources0 + 368 (CFRunLoop.c:2061)
73  CoreFoundation                	0x00000001a6d13b4c __CFRunLoopRun + 828 (CFRunLoop.c:2951)
74  CoreFoundation                	0x00000001a6d276b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
75  GraphicsServices              	0x00000001c2dc1374 GSEventRunModal + 164 (GSEvent.c:2200)
76  UIKitCore                     	0x00000001a968ce88 -[UIApplication _run] + 1100 (UIApplication.m:3511)
77  UIKitCore                     	0x00000001a940e5ec UIApplicationMain + 364 (UIApplication.m:5064)
78  Stitcher                      	0x00000001006d3eb8 main + 68 (AppDelegate.swift:22)
79  dyld                          	0x0000000101041ce4 start + 520 (dyldMain.cpp:879)

Can you reproduce the bug?

Not yet

Reproduction Steps

No response

Version

10.20

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS 10.15.4

Build environment

Xcode version: 13.2.1
Dependency manager and version: Cocoapods 1.10.2

@ayush-ttn ayush-ttn changed the title Crash when accessing Realm Crash when initializing Realm Apr 29, 2022
@dianaafanador3
Copy link
Contributor

Hi @ayush-ttn, like mentioned before this crashes may be caused by a file corruption. Make sure to update to our latest version 10.25.2 which includes a fix (from 10.24.2) for a similar issue realm/realm-core#5334.
If that's not the case, in order to help you diagnose this issue we need more information.
First if you are able to reproduce this, a code sample would be very helpful, also you can send us the code on the DB class, and the code on the App initialisation. AppDelegate.application(_:willFinishLaunchingWithOptions:), so we are able to reproduce this.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label May 2, 2022
@ayush-ttn
Copy link
Author

ayush-ttn commented May 2, 2022

Screenshot 2022-05-02 at 11 56 45 PM

Thanks for responding @dianaafanador3. I added 10.25.2 to podfile but looks like it is not yet available for pods? This is how I am doing it pod 'RealmSwift', '10.25.2'

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 2, 2022
@dianaafanador3
Copy link
Contributor

Did you run pod update, before running pod install

@ayush-ttn
Copy link
Author

Let me try that as well...

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels May 2, 2022
@ritesh-kanchi
Copy link

We are having the exact same issue - never crashed on our side, and the app got past app review; We were on Realm 10.24, and can't even cause the app to crash on our end.

It's happening for <1% of users, but it's enough to be a big problem... Does 10.25 fix it?

@ayush-ttn
Copy link
Author

@ritesh-kanchi responded to you on the linked issue.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 9, 2022
@pavel-ship-it
Copy link
Contributor

@ayush-ttn hi, do you have any updates on that issue?

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels May 27, 2022
@ayush-ttn
Copy link
Author

@pavel-ship-it reponded you on the other thread

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 31, 2022
@pavel-ship-it
Copy link
Contributor

Thank you @ayush-ttn. In that case I close the issue.

@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label May 31, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 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

4 participants