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

RLMRealm.defaultRealm() crash #2653

Closed
shmakovigor opened this issue Oct 9, 2015 · 10 comments
Closed

RLMRealm.defaultRealm() crash #2653

shmakovigor opened this issue Oct 9, 2015 · 10 comments
Assignees
Labels

Comments

@shmakovigor
Copy link

I just call RLMRealm.defaultRealm() and got this crash:

Thread : Crashed: com.apple.main-thread
0  libsystem_kernel.dylib           __pthread_kill + 8
1  libsystem_pthread.dylib         pthread_kill + 112
2  libsystem_c.dylib                   abort + 112
3  Realm                                    please_report_this_error_to_help_at_realm_dot_io + 10
4  Realm                                    realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 316
5  libsystem_pthread.dylib         pthread_kill + 112
6  Realm                                    void realm::util::terminate<unsigned long, unsigned long>(char const*, char const*, long, unsigned long, unsigned long) + 396
7  Realm                                    realm::Group::attach(unsigned long) + 364
8  Realm                                    realm::SharedGroup::do_begin_read(realm::SharedGroup::VersionID) + 284
9  Realm                                    realm::SharedGroup::begin_read(realm::SharedGroup::VersionID) + 56
10 Realm                                   realm::SharedGroup::SharedGroup(realm::Replication&, realm::SharedGroup::DurabilityLevel, char const*) + 464
11 Realm                                  -[RLMRealm initWithPath:key:readOnly:inMemory:dynamic:error:] + 1088
12 Realm                                 +[RLMRealm realmWithConfiguration:error:] + 628
13 Realm                                 +[RLMRealm defaultRealm] + 76
14 VideoEditor                VideoEditorAPI.init() -> VideoEditorAPI (VideoEditorAPI.swift:17)
15 VideoEditor                VideoEditorAPI.__allocating_init() -> VideoEditorAPI (VideoEditorAPI.swift)
16 VideoEditor                globalinit_33_02D4E529071B597B26A5892690C761A1_func1 (VideoEditorAPI.swift)
17 libdispatch.dylib                  _dispatch_client_callout + 16
18 libdispatch.dylib                  dispatch_once_f + 96
19 VideoEditor                static VideoEditorAPI.(sharedInstance.getter).(Static #1).instance.unsafeMutableAddressor (VideoEditorAPI.swift:21)
20 VideoEditor                static VideoEditorAPI.sharedInstance.getter (VideoEditorAPI.swift:23)
21 VideoEditor                ProjectsViewController.viewDidLoad() -> () (ProjectsViewController.swift:54)
22 VideoEditor                @objc ProjectsViewController.viewDidLoad() -> () (ProjectsViewController.swift)
23 UIKit                                  -[UIViewController loadViewIfRequired] + 692
24 UIKit                                  -[UIViewController view] + 32
25 UIKit                                  -[UIWindow addRootViewControllerViewIfPossible] + 72
26 UIKit                                 -[UIWindow _setHidden:forced:] + 260
27 UIKit                                -[UIWindow makeKeyAndVisible] + 56
28 UIKit                               -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2804
29 UIKit                             -[UIApplication _runWithMainScene:transitionContext:completion:] + 1480
30 UIKit                             -[UIApplication workspaceDidEndTransaction:] + 184
31 FrontBoardServices      __31-[FBSSerialQueue performAsync:]_block_invoke + 28
32 CoreFoundation             __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
33 CoreFoundation            __CFRunLoopDoBlocks + 312
34 CoreFoundation           __CFRunLoopRun + 1756
35 CoreFoundation           CFRunLoopRunSpecific + 396
36 UIKit                            -[UIApplication _run] + 552
37 UIKit                            UIApplicationMain + 1488
38 VideoEditor         main (main.m:16)
39 libdyld.dylib                  start + 4
@mrackwitz
Copy link
Contributor

We're investigating this issue currently, but couldn't reproduce it yet. Can you reproduce it? Could you provide further info, which can help us to find out where this crash originates from, as: Did you saw any further output on the console or anything from the debugger? Did it occurred while debugging or with a release build? On device / simulator?

@shmakovigor
Copy link
Author

Unfortunately, I can't reproduce it. This crash occurs in release build from the App Store and only on one device (13 crashes, iPhone 5s, iOS 8, non jail, 589 MB free disk space, 1.14 GB free RAM)

@mrackwitz
Copy link
Contributor

Is there any chance that we could get the realm file from this device involved in the crash?

@shmakovigor
Copy link
Author

Im sorry, but we can't contact the user and ask him extract this file - he just downloaded the app and can't use it because of crash.

@mrackwitz
Copy link
Contributor

Can you say from the code path whether that happens only on first launch / the opposite?

@shmakovigor
Copy link
Author

This code is called every time when user launch the app. It seems there is problem of reading realm file - may be after Realm update in app

@shmakovigor
Copy link
Author

I've got similar crash on another app:

#0  0x000000019805b1e0 in __pthread_kill ()
#1  0x0000000198124f0c in pthread_kill ()
#2  0x0000000197fceb78 in abort ()
#3  0x0000000102ba7f7c in please_report_this_error_to_help_at_realm_dot_io ()
#4  0x0000000102ba8138 in realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) ()
#5  0x0000000102ad3124 in realm::util::terminate(char const*, char const*, long) at /Pods/Headers/Private/Realm/realm/util/terminate.hpp:38
#6  0x0000000102b1f8a4 in realm::_impl::TransactLogEncoder::insert_link_column(unsigned long, realm::DataType, realm::StringData, unsigned long, unsigned long) at /Pods/Headers/Private/Realm/realm/impl/transact_log.hpp:805
#7  0x0000000102b1a584 in realm::_impl::TransactReverser::erase_link_column(unsigned long, unsigned long, unsigned long) at /Pods/Headers/Private/Realm/realm/impl/transact_log.hpp:2075
#8  0x0000000102b19578 in void realm::_impl::TransactLogParser::parse_one<realm::_impl::TransactReverser>(realm::_impl::TransactReverser&) at /Pods/Headers/Private/Realm/realm/impl/transact_log.hpp:1621
#9  0x0000000102b187c0 in void realm::_impl::TransactLogParser::parse<realm::_impl::TransactReverser>(realm::_impl::NoCopyInputStream&, realm::_impl::TransactReverser&) at /Pods/Headers/Private/Realm/realm/impl/transact_log.hpp:1327
#10 0x0000000102b17704 in void realm::_impl::TransactLogParser::parse<realm::_impl::TransactReverser>(realm::_impl::InputStream&, realm::_impl::TransactReverser&) at /Pods/Headers/Private/Realm/realm/impl/transact_log.hpp:1334
#11 0x0000000102b17410 in void realm::SharedGroup::rollback_and_continue_as_read<realm::_impl::NullInstructionObserver>(realm::History&, realm::_impl::NullInstructionObserver*) at /Pods/Realm/include/realm/group_shared.hpp:945
#12 0x0000000102b172e0 in void realm::_impl::SharedGroupFriend::rollback_and_continue_as_read<realm::_impl::NullInstructionObserver>(realm::SharedGroup&, realm::History&, realm::_impl::NullInstructionObserver*) at /Pods/Realm/include/realm/group_shared.hpp:1016
#13 0x0000000102b172ac in realm::LangBindHelper::rollback_and_continue_as_read(realm::SharedGroup&, realm::History&) at /Pods/Realm/include/realm/lang_bind_helper.hpp:389
#14 0x0000000102b0f804 in auto RLMRollbackAndContinueAsRead(realm::SharedGroup&, realm::History&, RLMSchema*)::$_7::operator()<>() const at /Pods/Realm/Realm/RLMObservation.mm:746
#15 0x0000000102b0f74c in (anonymous namespace)::TransactLogHandler::TransactLogHandler<RLMRollbackAndContinueAsRead(realm::SharedGroup&, realm::History&, RLMSchema*)::$_7>(NSArray*, RLMRollbackAndContinueAsRead(realm::SharedGroup&, realm::History&, RLMSchema*)::$_7&&) at /Pods/Realm/Realm/RLMObservation.mm:498
#16 0x0000000102b02d34 in (anonymous namespace)::TransactLogHandler::TransactLogHandler<RLMRollbackAndContinueAsRead(realm::SharedGroup&, realm::History&, RLMSchema*)::$_7>(NSArray*, RLMRollbackAndContinueAsRead(realm::SharedGroup&, realm::History&, RLMSchema*)::$_7&&) at /Pods/Realm/Realm/RLMObservation.mm:495
#17 0x0000000102b02c64 in RLMRollbackAndContinueAsRead(realm::SharedGroup&, realm::History&, RLMSchema*) at Pods/Realm/Realm/RLMObservation.mm:745
#18 0x0000000102b65d60 in -[RLMRealm cancelWriteTransaction] Project/Amic/Pods/Realm/Realm/RLMRealm.mm:647
#19 0x0000000102af649c in RLMUpdateRealmToSchemaVersion at /Pods/Realm/Realm/RLMObjectStore.mm:183
#20 0x0000000102b638d0 in +[RLMRealm realmWithConfiguration:error:] Project/Amic/Pods/Realm/Realm/RLMRealm.mm:430
#21 0x000000010179c5a8 in @nonobjc RLMRealm.__allocating_init(configuration : RLMRealmConfiguration) throws -> RLMRealm ()
#22 0x00000001017991d4 in Realm.init(configuration : Realm.Configuration) throws -> Realm at Pods/RealmSwift/RealmSwift/Realm.swift:91
#23 0x0000000101799504 in Realm.__allocating_init(configuration : Realm.Configuration) throws -> Realm ()
#24 0x00000001001d765c in AppCache.clearCache() -> () 
#25 0x000000010025f284 in AppDelegate.configureRealm() -> () 
#26 0x000000010025ed00 in AppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [NSObject : AnyObject]?) -> Bool
#27 0x000000010025ef5c in @objc AppDelegate.application(UIApplication, didFinishLaunchingWithOptions : [NSObject : AnyObject]?) -> Bool ()
#28 0x00000001880e7184 in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#29 0x000000018830fe60 in -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] ()
#30 0x00000001883141a4 in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#31 0x00000001883112e4 in -[UIApplication workspaceDidEndTransaction:] ()
#32 0x000000018c8637ec in -[FBSSerialQueue _performNext] ()
#33 0x000000018c863b6c in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#34 0x0000000182ad45a4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#35 0x0000000182ad4038 in __CFRunLoopDoSources0 ()
#36 0x0000000182ad1d38 in __CFRunLoopRun ()
#37 0x0000000182a00dc0 in CFRunLoopRunSpecific ()
#38 0x00000001880e00ac in -[UIApplication _run] ()
#39 0x00000001880daf44 in UIApplicationMain ()
#41 0x0000000197f3e8b8 in start ()

Debug log:

/Pods/Headers/Private/Realm/realm/impl/transact_log.hpp:805: [realm-core-0.92.1] Assertion failed: _impl::TableFriend::is_link_type(ColumnType(type))
0   Realm                               0x0000000102ba8028 _ZN5realm4util18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 44
1   Realm                               0x0000000102ad3124 _ZN5realm4util9terminateEPKcS2_l + 1196
2   Realm                               0x0000000102b1f8a4 _ZN5realm5_impl18TransactLogEncoder18insert_link_columnEmNS_8DataTypeENS_10StringDataEmm + 100
3   Realm                               0x0000000102b1a584 _ZN5realm5_impl16TransactReverser17erase_link_columnEmmm + 152
4   Realm                               0x0000000102b19578 _ZN5realm5_impl17TransactLogParser9parse_oneINS0_16TransactReverserEEEvRT_ + 3140
5   Realm                               0x0000000102b187c0 _ZN5realm5_impl17TransactLogParser5parseINS0_16TransactReverserEEEvRNS0_17NoCopyInputStreamERT_ + 84
6   Realm                               0x0000000102b17704 _ZN5realm5_impl17TransactLogParser5parseINS0_16TransactReverserEEEvRNS0_11InputStreamERT_ + 112
7   Realm                               0x0000000102b17410 _ZN5realm11SharedGroup29rollback_and_continue_as_readINS_5_impl23NullInstructionObserverEEEvRNS_7HistoryEPT_ + 292
8   Realm                               0x0000000102b172e0 _ZN5realm5_impl17SharedGroupFriend29rollback_and_continue_as_readINS0_23NullInstructionObserverEEEvRNS_11SharedGroupERNS_7HistoryEPT_ + 40
9   Realm                               0x0000000102b172ac _ZN5realm14LangBindHelper29rollback_and_continue_as_readERNS_11SharedGroupERNS_7HistoryE + 44
10  Realm                               0x0000000102b0f804 _ZZ28RLMRollbackAndContinueAsReadRN5realm11SharedGroupERNS_7HistoryEP9RLMSchemaENK3$_7clIJEEEDaDpOT_ + 36
11  Realm                               0x0000000102b0f74c _ZN12_GLOBAL__N_118TransactLogHandlerC2IZ28RLMRollbackAndContinueAsReadRN5realm11SharedGroupERNS2_7HistoryEP9RLMSchemaE3$_7EEP7NSArrayOT_ + 356
12  Realm                               0x0000000102b02d34 _ZN12_GLOBAL__N_118TransactLogHandlerC1IZ28RLMRollbackAndContinueAsReadRN5realm11SharedGroupERNS2_7HistoryEP9RLMSchemaE3$_7EEP7NSArrayOT_ + 80
13  Realm                               0x0000000102b02c64 _Z28RLMRollbackAndContinueAsReadRN5realm11SharedGroupERNS_7HistoryEP9RLMSchema + 128
14  Realm                               0x0000000102b65d60 -[RLMRealm cancelWriteTransaction] + 216
15  Realm                               0x0000000102af649c RLMUpdateRealmToSchemaVersion + 1676
16  Realm                               0x0000000102b638d0 +[RLMRealm realmWithConfiguration:error:] + 4148
17  RealmSwift                          0x000000010179c5a8 _TTOFCSo8RLMRealmCfMS_FzT13configurationCSo21RLMRealmConfiguration_S_ + 108
18  RealmSwift                          0x00000001017991d4 _TFC10RealmSwift5RealmcfMS0_FzT13configurationVS0_13Configuration_S0_ + 360
19  RealmSwift                          0x0000000101799504 _TFC10RealmSwift5RealmCfMS0_FzT13configurationVS0_13Configuration_S0_ + 420
20  Amic                                0x00000001001d765c _TFC4Amic9AmicCache10clearCachefS0_FT_T_ + 196
21  Amic                                0x000000010025f284 _TFC4Amic11AppDelegate14configureRealmfS0_FT_T_ + 764
22  Amic                                0x000000010025ed00 _TFC4Amic11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 1220
23  Amic                                0x000000010025ef5c _TToFC4Amic11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 208
24  UIKit                               0x00000001880e7184 <redacted> + 400
25  UIKit                               0x000000018830fe60 <redacted> + 2904
26  UIKit                               0x00000001883141a4 <redacted> + 1660
27  UIKit                               0x00000001883112e4 <redacted> + 168
28  FrontBoardServices                  0x000000018c8637ec <redacted> + 184
29  FrontBoardServices                  0x000000018c863b6c <redacted> + 56
30  CoreFoundation                      0x0000000182ad45a4 <redacted> + 24
31  CoreFoundation                      0x0000000182ad4038 <redacted> + 540
32  CoreFoundation                      0x0000000182ad1d38 <redacted> + 724
33  CoreFoundation                      0x0000000182a00dc0 CFRunLoopRunSpecific + 384
34  UIKit                               0x00000001880e00ac <redacted> + 460
35  UIKit                               0x00000001880daf44 UIApplicationMain + 204
36  Amic                                0x0000000100261074 main + 136
37  libdyld.dylib                       0x0000000197f3e8b8 <redacted> + 4
IMPORTANT: if you see this error, please send this log to help@realm.io.

Code:

    func clearCache() {

        do {

            let realm = try Realm() // <-- this cause crash
            do {
                try realm.write {
                    realm.deleteAll()
                }
            } catch let error { print(error) }
        } catch let error { print(error) }
    }

@realm-ci realm-ci removed the pending label Oct 19, 2015
@mrackwitz
Copy link
Contributor

I'm pretty sure that the latter crash log is unrelated to the first one. We saw those before and reportedly could fix them in the last recent core releases. You can get the fix by updating to 0.96.0.

We would still need further information to be able to investigate the first crash.

@jpsim jpsim added the pending label Oct 19, 2015
@jpsim
Copy link
Contributor

jpsim commented Nov 6, 2015

@shmakovigor just following up on our request for more information. We don't have enough information to reproduce this issue currently, so it'll be difficult to assess what's happening.

@mrackwitz
Copy link
Contributor

The latest release might fix this issue. I'll close this for now as we didn't got here any further info to act on, but please feel free, if that should still appear with the latest version to re-open this issue.

@mrackwitz mrackwitz removed the pending label Dec 10, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants