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 in EncryptedFileMapping::read_barrier #6679

Closed
jwzhuang opened this issue Jul 30, 2020 · 5 comments
Closed

Crash in EncryptedFileMapping::read_barrier #6679

jwzhuang opened this issue Jul 30, 2020 · 5 comments
Assignees

Comments

@jwzhuang
Copy link

jwzhuang commented Jul 30, 2020

0   libsystem_kernel.dylib        	0x00000001b974adf0 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001b966a930 pthread_kill + 228 (pthread.c:1458)
2   libsystem_c.dylib             	0x00000001b95f8ba4 abort + 104 (abort.c:110)
3   Realm                         	0x00000001040b7078 please_report_this_error_to_help_at_realm_dot_io + 12
4   Realm                         	0x00000001040b7384 realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 328
5   Realm                         	0x00000001040b76f4 realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 388
6   Realm                         	0x0000000104001e40 void realm::util::terminate_with_info<unsigned long&, unsigned long&>(char const*, int, char const*, char const*, unsigned long&&&, unsigned long&&&) + 68
7   Realm                         	0x000000010409f4f8 realm::util::EncryptedFileMapping::read_barrier(void const*, unsigned long, unsigned long (*)(char const*)) + 504
8   Realm                         	0x0000000103d9ffb0 realm::util::do_encryption_read_barrier(void const*, unsigned long, unsigned long (*)(char const*), realm::util::EncryptedFileMapping*) + 84
9   Realm                         	0x0000000103fea074 realm::Group::attach(unsigned long, bool, bool) + 136
10  Realm                         	0x0000000103ff1808 realm::Group::advance_transact(unsigned long, unsigned long, realm::_impl::NoCopyInputStream&, bool) + 380
11  Realm                         	0x0000000103ecaf34 void realm::Transaction::rollback_and_continue_as_read<realm::_impl::NullInstructionObserver>(realm::_impl::NullInstructionObserver*) + 408 (db.hpp:928)
12  Realm                         	0x0000000103ec9cb4 realm::_impl::transaction::cancel(realm::Transaction&, realm::BindingContext*) + 704 (db.hpp:576)
13  Realm                         	0x0000000103ea3ca0 realm::Realm::cancel_transaction() + 64 (shared_realm.cpp:686)
14  Realm                         	0x0000000103e733d4 -[RLMRealm cancelWriteTransaction] + 20 (RLMRealm.mm:730)
15  Realm                         	0x0000000103e73654 -[RLMRealm dealloc] + 52 (RLMRealm.mm:808)
16  libobjc.A.dylib               	0x00000001b9695358 AutoreleasePoolPage::releaseUntil(objc_object**) + 184 (NSObject.mm:780)
17  libobjc.A.dylib               	0x00000001b9695244 objc_autoreleasePoolPop + 232 (NSObject.mm:1040)
18  libswiftObjectiveC.dylib      	0x00000001f0490c2c autoreleasepool<A>(invoking:) + 76 (ObjectiveC.swift:0)
19  AnboTalk                      	0x000000010279f420 partial apply for closure #1 in RealmManager.writeAsyncObjs(priority:block:onSuccess:onFailure:) + 88 (RealmManager.swift:2234)
20  AnboTalk                      	0x00000001026c2184 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
21  libdispatch.dylib             	0x00000001b9602ec4 _dispatch_call_block_and_release + 32 (init.c:1408)
22  libdispatch.dylib             	0x00000001b960433c _dispatch_client_callout + 20 (object.m:495)
23  libdispatch.dylib             	0x00000001b96136e8 _dispatch_root_queue_drain + 644 (inline_internal.h:2484)
24  libdispatch.dylib             	0x00000001b9613d9c _dispatch_worker_thread2 + 116 (queue.c:6628)
25  libsystem_pthread.dylib       	0x00000001b966b6d8 _pthread_wqthread + 216 (pthread.c:2364)
26  libsystem_pthread.dylib       	0x00000001b96719c8 start_wqthread + 8

Code Sample

private func writeAsyncObjs(priority:DispatchQoS = .default, block: @escaping ((Realm) -> Void), onSuccess successClosure: @escaping (() -> Void) = { }, onFailure failureClosure: @escaping ((_ error : Swift.Error) -> Void) = { _ in }) {
		DispatchQueue.global(qos: priority.qosClass).async {
			autoreleasepool {
				do {
					let realm = try Realm(configuration: self._realmConfig)
					try realm.write {
						block(realm)
					}
					successClosure()
				}
				catch {
					failureClosure(error)
				}
			}
		}
	}

Realm framework version: 5.3.2

Realm Object Server version: ?

Xcode version: 11.6

iOS/OSX version: iPhone OS 13.5.1

@jain-mj
Copy link

jain-mj commented Jul 30, 2020

We are also facing the same issue in our app, we have released a new version using the latest realm-cocoa but its still crashing.

Thread 0#0 (null) in __pthread_kill ()
#1 (null) in pthread_kill ()
#2 (null) in __abort ()
#3 (null) in abort ()
#4 (null) in please_report_this_error_to_help_at_realm_dot_io ()
#5 (null) in realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits, std::__1::allocator >&) ()
#6 (null) in realm::util::terminate(char const*, char const*, long, std::initializer_listrealm::util::Printable&&) ()
#7 (null) in realm::Obj::remove_backlink(realm::ColKey, realm::ObjKey, realm::CascadeState&) ()
#8 (null) in realm::Obj& realm::Obj::setrealm::ObjKey(realm::ColKey, realm::ObjKey, bool) ()
#9 (null) in realm::Table::migrate_links(realm::util::FunctionRef<void ()>) ()
#10 (null) in realm::Transaction::upgrade_file_format(int) ()
#11 (null) in realm::DB::upgrade_file_format(bool, int, int, int) ()
#12 (null) in realm::DB::do_open(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool, bool, realm::DBOptions) ()
#13 (null) in realm::DB::open(realm::Replication&, realm::DBOptions) ()
#14 (null) in realm::DB::create(realm::Replication&, realm::DBOptions) ()
#15 (null) in realm::_impl::RealmCoordinator::open_db() ()
#16 (null) in realm::_impl::RealmCoordinator::do_get_realm(realm::Realm::Config, std::__1::shared_ptrrealm::Realm&, realm::util::Optionalrealm::VersionID, realm::util::CheckedUniqueLock&) ()
#17 (null) in realm::_impl::RealmCoordinator::get_realm(realm::Realm::Config, realm::util::Optionalrealm::VersionID) ()
#18 0x0000000102656708 in realm::Realm::get_shared_realm(realm::Realm::Config) at /Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:144
#19 0x0000000102625d2c in +[RLMRealm realmWithConfiguration:queue:error:] at /Pods/Realm/Realm/RLMRealm.mm:504
#20 (null) in Realm.init(configuration:queue:) ()
#21 0x0000000100771250 in RealmManager.().init() at /Commons/Utilities/Database/Database.swift:24
#22 (null) in globalinit_33_25FF074A40C3C60802D1C0FEE730F2A4_func1972 ()
#23 (null) in _dispatch_client_callout ()
#24 (null) in _dispatch_once_callout ()
#25 (null) in swift_once ()
#26 0x0000000100770e58 in globalinit_33_25FF074A40C3C60802D1C0FEE730F2A4_func1971 at /Commons/Utilities/Database/Database.swift:17
#27 (null) in dispatch_client_callout ()
#28 (null) in dispatch_once_callout ()
#29 (null) in swift_once ()
#30 0x000000010060e8bc in HomeCrossSellManager.getCrossSellData() at /Commons/Utilities/Database/Database.swift:14
#31 0x00000001002faf6c in specialized HomeSectionsManager.tableView(
:numberOfRowsInSection:) at /Users/mukuljain/MukulJain/Projects/Trains/Trains/Trains/Epics/Core/Home Screen/Managers/HomeSectionsManager.swift:266
#32 (null) in @objc HomeSectionsManager.tableView(
:numberOfRowsInSection:) ()
#33 (null) in -[UITableView _numberOfRowsInSection:] ()
#34 (null) in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] ()
#35 (null) in -[UITableViewRowData _ensureSectionOffsetIsValidForSection:] ()
#36 (null) in -[UITableViewRowData numberOfRows] ()
#37 (null) in -[UITableView noteNumberOfRowsChanged] ()
#38 (null) in -[UITableView reloadData] ()
#39 0x0000000100691848 in HomeViewController.filterSections(sectionIds:stickySectionId:) at /Home Screen/Managers/HomeSectionsManager.swift:64
#40 0x00000001006906dc in HomeViewController.configureView() at /Core/Home Screen/ViewControllers/HomeViewController.swift:203
#41 0x000000010068e9e8 in HomeViewController.viewDidLoad() at /Core/Home Screen/ViewControllers/HomeViewController.swift:65
#42 (null) in @objc HomeViewController.viewDidLoad() ()
#43 (null) in -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] ()
#44 (null) in -[UIViewController loadViewIfRequired] ()
#45 (null) in -[UINavigationController _updateScrollViewFromViewController:toViewController:] ()
#46 (null) in -[UINavigationController _startTransition:fromViewController:toViewController:] ()
#47 (null) in -[UINavigationController _startDeferredTransitionIfNeeded:] ()
#48 (null) in -[UINavigationController __viewWillLayoutSubviews] ()
#49 (null) in -[UILayoutContainerView layoutSubviews] ()
#50 (null) in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#51 (null) in -[CALayer layoutSublayers] ()
#52 (null) in CA::Layer::layout_if_needed(CA::Transaction*) ()
#53 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#54 (null) in CA::Context::commit_transaction(CA::Transaction*, double) ()
#55 (null) in CA::Transaction::commit() ()
#56 (null) in __34-[UIApplication _firstCommitBlock]_block_invoke_2 ()
#57 (null) in CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK ()
#58 (null) in __CFRunLoopDoBlocks ()
#59 (null) in __CFRunLoopRun ()
#60 (null) in CFRunLoopRunSpecific ()
#61 (null) in GSEventRunModal ()
#62 (null) in UIApplicationMain ()
#63 0x00000001000b73a8 in main at /Commons/App Managers/Notifications/NotificationManager.swift:21
#64 (null) in start ()

@tgoyne latest release of version 5.3.2 didn't solve the issue

@RealmBot RealmBot changed the title please_report_this_error_to_help_at_realm_dot_io Crash in EncryptedFileMapping::read_barrier Sep 28, 2020
@bmunkholm
Copy link
Contributor

@jain-mj The crash you have reported is not the same as the original. Can you please upgrade to latest version and try again. Issues around migration has been solved since you reported your issue.

@bmunkholm bmunkholm assigned leemaguire and unassigned jsflax Sep 28, 2020
@bmunkholm
Copy link
Contributor

@jwzhuang Can you also please check with the latest version and verify your issue is still present?

@finnschiermer
Copy link

@jwzhuang Quick check question: Are you using encryption?

@finnschiermer
Copy link

This bug has not been reported again since first reported. I consider it fixed by Core 6.0.15 which was released Aug 5th. No response from OP since.

@jwzhuang Plese reopen this if you still encounter the bug on a new release.

@jain-mj The bug you are reporting is different and should not be part of this issue. Please open a new issue for your bug, if you still see it on a new version.

@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

6 participants