realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1.01k stars 155 forks source link

SIGABRT in the core, apparently #2505

Closed gritzko closed 7 years ago

gritzko commented 7 years ago

The crash is made by clicking buttons randomly in RealmTasks the macOS version.

Thread 1Queue : com.apple.main-thread (serial)
#0  0x00007fff8ee13dd6 in __pthread_kill ()
#1  0x0000000101652a1c in pthread_kill ()
#2  0x00007fff8ed79420 in abort ()
#3  0x00007fff8d8d485a in abort_message ()
#4  0x00007fff8d8f9c37 in default_terminate_handler() ()
#5  0x00007fff8e403f33 in _objc_terminate() ()
#6  0x00007fff8d8f6d69 in std::__terminate(void (*)()) ()
#7  0x00007fff8d8f67de in __cxa_throw ()
#8  0x000000010067743d in realm::SharedGroup::export_linkview_for_handover(std::__1::shared_ptr<realm::LinkView> const&) ()
#9  0x0000000100236f1f in realm::_impl::ListNotifier::ListNotifier(std::__1::shared_ptr<realm::LinkView>, std::__1::shared_ptr<realm::Realm>) at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/Pods/Realm/Realm/ObjectStore/src/impl/list_notifier.cpp:35
#10 0x0000000100237385 in realm::_impl::ListNotifier::ListNotifier(std::__1::shared_ptr<realm::LinkView>, std::__1::shared_ptr<realm::Realm>) at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/Pods/Realm/Realm/ObjectStore/src/impl/list_notifier.cpp:31
#11 0x000000010023602a in std::__1::__libcpp_compressed_pair_imp<std::__1::allocator<realm::_impl::ListNotifier>, realm::_impl::ListNotifier, 1u>::__libcpp_compressed_pair_imp<std::__1::allocator<realm::_impl::ListNotifier>&, std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&, 0ul, 0ul, 1ul>(std::__1::piecewise_construct_t, std::__1::tuple<std::__1::allocator<realm::_impl::ListNotifier>&>, std::__1::tuple<std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>, std::__1::__tuple_indices<0ul>, std::__1::__tuple_indices<0ul, 1ul>) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2194
#12 0x0000000100235e7d in std::__1::__compressed_pair<std::__1::allocator<realm::_impl::ListNotifier>, realm::_impl::ListNotifier>::__compressed_pair<std::__1::allocator<realm::_impl::ListNotifier>&, std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>(std::__1::piecewise_construct_t, std::__1::tuple<std::__1::allocator<realm::_impl::ListNotifier>&>, std::__1::tuple<std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2457
#13 0x0000000100235dfc in std::__1::__compressed_pair<std::__1::allocator<realm::_impl::ListNotifier>, realm::_impl::ListNotifier>::__compressed_pair<std::__1::allocator<realm::_impl::ListNotifier>&, std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>(std::__1::piecewise_construct_t, std::__1::tuple<std::__1::allocator<realm::_impl::ListNotifier>&>, std::__1::tuple<std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2460
#14 0x0000000100235dc4 in std::__1::__shared_ptr_emplace<realm::_impl::ListNotifier, std::__1::allocator<realm::_impl::ListNotifier> >::__shared_ptr_emplace<std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>(std::__1::allocator<realm::_impl::ListNotifier>, std::__1::shared_ptr<realm::LinkView>&&&, std::__1::shared_ptr<realm::Realm>&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3800
#15 0x0000000100235b4a in std::__1::__shared_ptr_emplace<realm::_impl::ListNotifier, std::__1::allocator<realm::_impl::ListNotifier> >::__shared_ptr_emplace<std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>(std::__1::allocator<realm::_impl::ListNotifier>, std::__1::shared_ptr<realm::LinkView>&&&, std::__1::shared_ptr<realm::Realm>&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3801
#16 0x0000000100235b27 in std::__1::shared_ptr<realm::_impl::ListNotifier> std::__1::shared_ptr<realm::_impl::ListNotifier>::make_shared<std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>(std::__1::shared_ptr<realm::LinkView>&&&, std::__1::shared_ptr<realm::Realm>&&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4411
#17 0x00000001002339e5 in std::__1::enable_if<!(is_array<realm::_impl::ListNotifier>::value), std::__1::shared_ptr<realm::_impl::ListNotifier> >::type std::__1::make_shared<realm::_impl::ListNotifier, std::__1::shared_ptr<realm::LinkView>&, std::__1::shared_ptr<realm::Realm>&>(std::__1::shared_ptr<realm::LinkView>&&&, std::__1::shared_ptr<realm::Realm>&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4775
#18 0x00000001002339aa in realm::List::add_notification_callback(realm::CollectionChangeCallback) & at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/Pods/Realm/Realm/ObjectStore/src/list.cpp:221
#19 0x00000001002d82a6 in RLMNotificationToken* RLMAddNotificationBlock<realm::List>(objc_object*, realm::List&, void (objc_object*, RLMCollectionChange*, NSError*) block_pointer, bool) at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/Pods/Realm/Realm/RLMCollection.mm:349
#20 0x00000001002cc613 in ::-[RLMArrayLinkView addNotificationBlock:](void (^)(RLMArray *, RLMCollectionChange *, NSError *)) at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/Pods/Realm/Realm/RLMArrayLinkView.mm:450
#21 0x0000000100bd7f6e in List.addNotificationBlock((RealmCollectionChange<List<A>>) -> ()) -> RLMNotificationToken at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/Pods/RealmSwift/RealmSwift/List.swift:466
#22 0x0000000100003f68 in ListViewController.setupNotifications() -> () at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/RealmTasks macOS/ListViewController.swift:119
#23 0x0000000100003ccf in ListViewController.viewDidLoad() -> () at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/RealmTasks macOS/ListViewController.swift:98
#24 0x00000001000042e2 in @objc ListViewController.viewDidLoad() -> () ()
#25 0x00007fff7730ed53 in -[NSViewController _sendViewDidLoad] ()
#26 0x00007fff773057b3 in -[NSViewController _loadViewIfRequired] ()
#27 0x00007fff773055ed in -[NSViewController view] ()
#28 0x0000000100013814 in ContainerViewController.presentViewController<A where ...> (for : A) -> () at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/RealmTasks macOS/ContainerViewController.swift:61
#29 0x00000001000134e1 in ContainerViewController.showAllLists(AnyObject?) -> () at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/RealmTasks macOS/ContainerViewController.swift:48
#30 0x0000000100013556 in @objc ContainerViewController.showAllLists(AnyObject?) -> () ()
#31 0x00007fff775dc442 in -[NSToolbarButton sendAction:to:] ()
#32 0x00007fff77518ef0 in -[NSToolbarItemViewer mouseDown:] ()
#33 0x00007fff77bb3603 in -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] ()
#34 0x00007fff77bafe20 in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] ()
#35 0x00007fff77baf2be in -[NSWindow(NSEventRouting) sendEvent:] ()
#36 0x00007fff77a37bf5 in -[NSApplication(NSEvent) sendEvent:] ()
#37 0x00007fff772b3f81 in -[NSApplication run] ()
#38 0x00007fff7727e850 in NSApplicationMain ()
#39 0x0000000100028584 in main at /Users/gritzko/Projects/RealmTasks/RealmTasks Apple/RealmTasks macOS/AppDelegate.swift:25
#40 0x00007fff8ece5255 in start ()
#41 0x00007fff8ece5255 in start ()

Pod versions:

  - Realm (2.4.3):
    - Realm/Headers (= 2.4.3)
  - Realm/Headers (2.4.3)
  - RealmLoginKit (0.0.9):
    - Realm
    - TORoundedTableView
  - RealmSwift (2.4.3):
    - Realm (= 2.4.3)
finnschiermer commented 7 years ago

This is likely because Core is throwing a "LogicError::wrong_transact_state", because an attempt is made to export for handover without being inside a read transaction (either because it's during a write transaction or because it's outside any transaction).

It is only possibly to export for handover from inside a read transaction, because otherwise the state of what is being exported is not well defined.

In summary, this is likely not a bug in Core, but a bug in the usage of Core.

finnschiermer commented 7 years ago

@gritzko If the above makes sense to you, I'll close this issue.

gritzko commented 7 years ago

@stel it is an example app, it should make a good example :)

stel commented 7 years ago

@gritzko could you please create an issue in RealmTasks repo then?