-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
realm::util::EncryptedFileMapping::read_barrier #6763
Comments
@jedelbo @finnschiermer |
Not the latest changes. I think it looks like something we have seen before - I just can't find it. |
@jedelbo is that resolved in any specific version. We adopted the latest Realm (5.3.6 followed by 5.4.0) to avoid the deadlock case on iOS 14. Do we need to perform / modify any changes from application side to avoid the realm::util::EncryptedFileMapping::read_barrier issue ? |
If you get this error, it is definitely a problem that should be solved in the storage engine. If you see this in v5.3.4, then the problem has not been solved. |
Thanks @jedelbo , when can we expect the release with this fix? |
Looks like realm/realm-core#3838. (which was considered fixed - that's why you'd seen it before @jedelbo) @ganesh-ananthan Are you using encryption in your app? |
@finnschiermer No we are not using encryption. We kept the realm file in shared group directory and accessing from app and notification extension. |
@ganesh-ananthan Thx. This is a bug we cannot reproduce at the moment, so any additional observations, clues etc are very welcome. A repro case could make a huge difference. |
We don't have a standard case to get this issue, we got this crash in different scenario where we do access the realm from different thread. After update to latest Realm (5.3.6, 5.4.0) we do see such a crash. Here are points you can consider that we use Realm in our app
|
This crash is happening since v5.0.0, I'm trying hard to find a way to reproduce, but it's totally random. I have 3 different crash reports with the same error, and the problem is almost always in the same line of code:
After some investigation, I've seen this could be related to the Collection implementation of Realm, so I've changed the code above to this one:
I was hoping that using a Crash reports: |
This is most probably solved by realm/realm-core#3935. At least the crashes reported just above. |
@jedelbo as soon a new version is released, I'll update and observe. I hope we can finally close this issue. Thanks. |
Any updates on this? For me, it crashes quite often, especially when debugging with Simulator. |
@endore8 can you please update to version 5.4.5 and see if you still experience the issue? |
@leemaguire, it stopped crashing continuously after updating to 5.4.5! Let's see how it is overtime 🤞 Update: after a few minutes got it again 😭 |
@endore8 can you post a stacktrace of your crash? |
@leemaguire
This is the stack trace:
|
Just encounter the same issue on Realm Cocoa 5.4.1.
|
This issue #6556 was marked "Probably fixed by realm/realm-core#3828." by @tgoyne. But now it is clear that it still exists. |
@owenzhao Can you update to 5.4.6 and see if it solves your issue, also can you give us a reproduction case? Thanks |
@endore8 Can you post a complete code sample to help reproduce this issue? Thanks |
@leemaguire , although yesterday it seemed to work fine, today I experienced the same crash a few times again 😭 This is a code sample copied from the codebase. Don't know if that matters, but it is run in a background thread.
|
It is hard to reproduce this issue as it happens randomly. I had tried to reproduce it at the moment when it happened with the same situation and it didn't happen again. However, this also proved that it was something related to concurrent threads like situation, which sometimes code didn't work in the order expected. Maybe focusing on the crashed queue |
@leemaguire I just had a look on the revised history of realm-core/src/realm/db.cpp. I found that this file was changed on https://github.com/realm/realm-core/pull/3828/files to fixed the issue we talking. Then the line that fixed the issue was revised by realm/realm-core@90a4fe3#diff-1cdb349fd195d488a6ddbf55865d8ace to fixed another crashing issue. Maybe you should take a look on that and see if it was a regression. |
I can see that the problem reported by @endore8 and the problem reported reported by @owenzhao is not the same. If we concentrate on the first problem, then @endore8 says that "Once it crashes once, it starts crashing continuously.". This suggest that you have a realm file that causes this behavior. RIght? |
I don't think "continuously" here means constantly. As in the very top, he said "Application getting crash intermittently after upgraded to version 5.3.6 and 5.4.0." So the "continuously" here meant the crash was more frequently. However, in my case the crash was not rare and random. Maybe that depending on the system situation or CPU loads. |
We are also seeing this crash:
|
Still seeing this crash with 5.5.0. Is there anyone who can help look into this @leemaguire, or anyone who can help us figure out a path forward? We'd be more than happy to provide sysdiagnose and crash logs if that's helpful. Thanks! Crashed: com.apple.main-thread |
Getting similar crash on version 5.4.8:
|
Is there any update on this issue? We still see similar crash on version 5.5.0.
Trace:
|
@xilin 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? |
@jsflax we encountered this issue more frequent recently, could you help check?
The code lead to this crash realm?.object(ofType: SomeObject.self, forPrimaryKey: id) |
Is there any more context to that code? What's running on the main thread? The more information, the better 😄 . cc'ing @finnschiermer |
For more information: realm?.object(ofType: SomeObject.self, forPrimaryKey: id) The code above actually run on main thread. (Sorry for misinformation) The context: |
@thanhan123 Which version of Realm are you using? |
@finnschiermer I used Realm version 10.7.4 |
@thanhan123 you wrote: "In the app we used Realm.Configuration(encryptionKey: realmDataKey)" Does this mean that you are using encryption? Or that you are not? |
It means that I am using encryption in my app. |
@thanhan123 Can you reproduce it reliably? If so, is there any way for us to get a repro-case from you? |
@thanhan123 Are you able to provide Finn with this? |
I'm experiencing this error as well, it consistently occurs when the app's memory usage gets very high. Specifically, we have an in-app stream that makes network requests, writes the result to Realm, and then reads it back and displays it in the stream. If the user hits somewhere between 400MB-600MB of memory usage, the app hits this error. What's interesting is what appears just before the crash stack trace in the log, Not sure if it's helpful but the debugger reports the following on crash, In this crash the Hopefully that's not all just noise, seeing the crashes though I thought it might be related to the process' address space. |
@finnschiermer Sorry but somehow I cannot reproduce this bug with simpler project. I made one to mimic my current project but it doesn't crash at all. |
We need a repro case to make progress, I'm afraid. Extended testing has not hit this. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
Application getting crash intermittently after upgraded to version 5.3.6 and 5.4.0.
Realm framework version: 5.4.0
Xcode version: 11.2
iOS/OSX version: 13.7
Dependency manager + version: CocoaPod Latest
Incident Identifier: 901c3fd7-625d-4173-95a0-80f6da312643
CrashReporter Key: B5E6761D-6702-4CC1-A55F-EDF920BD93A9
Hardware Model: iPhone8,2
Process: AppName [377]
Path: /private/var/containers/Bundle/Application/3F38930D-33A7-4029-BBCC-755A766D8177/AppName.app/AppName
Identifier: com.domain.phone2
Version: 4.0.955 (4.0.955)
Code Type: arm64
Parent Process: ??? [1]
Date/Time: 2020-09-13T19:18:20.999Z
Launch Time: 2020-09-13T18:52:06Z
OS Version: iPhone OS 13.7 (17H35)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x1a
Crashed Thread: 24
Thread 24 Crashed:
0 Realm 0x00000001023f1f70 realm::util::EncryptedFileMapping::read_barrier(void const_, unsigned long, unsigned long ()(char const*)) + 32
1 Realm 0x00000001020de844 realm::util::do_encryption_read_barrier(void const, unsigned long, unsigned long ()(char const), realm::util::EncryptedFileMapping_) (file_mapper.hpp:133)
2 Realm 0x00000001023c73e0 realm::Table::init(unsigned long, realm::ArrayParent*, unsigned long, bool, bool) + 516
3 Realm 0x0000000102322efc realm::Group::create_table_accessor(unsigned long) + 752
4 Realm 0x0000000102322bac realm::Group::do_get_table(unsigned long) + 92
5 Realm 0x00000001020f2714 realm::ObjectSchema::ObjectSchema(realm::Group const&, realm::StringData, realm::TableKey) (group.hpp:1169)
6 Realm 0x00000001020f9cb0 realm::ObjectStore::schema_from_group(realm::Group const&) (memory:1826)
7 Realm 0x00000001021dce64 realm::Realm::read_schema_from_group_if_needed() (shared_realm.cpp:202)
8 Realm 0x00000001021dd2e0 realm::Realm::begin_read(realm::VersionID) (shared_realm.cpp:138)
9 Realm 0x00000001021dd1ac realm::Realm::read_group() (shared_realm.cpp:97)
10 Realm 0x00000001021de0b8 realm::Realm::do_refresh() (shared_realm.cpp:858)
11 Realm 0x00000001021ae1b0 -[RLMRealm refresh] (RLMRealm.mm:818)
12 RealmSwift 0x000000010292f604 RealmSwift.Realm.refresh() -> Swift.Bool (Realm.swift:754)
13 AppName 0x0000000100e1f238 function signature specialization <Arg[0] = Dead> of generic specialization <AppName.MStoreDate> of AppName.UnifiedDatabase.(realm in _15EE5ABE828ED209C1CFF5BDEB0C36C4).getter : RealmSwift.Realm? (UnifiedDatabase.swift:31)
14 AppName 0x0000000100e1b680 function signature specialization <Arg[3] = Dead> of generic specialization <AppName.Message> of AppName.UnifiedDatabase.fetch(predicate: __C.NSPredicate?, sortDescriptors: [RealmSwift.SortDescriptor]?, count: Swift.Int?)
> [A.ModelType] (<compilergenerated>:0)15 AppName 0x00000001002d8d70 closure #1 (AppName.ConversationModel) -> Swift.Bool in closure #1 ([AppName.ConversationModel])
> () in closure #3 (Swift.String)> () in AppName.MessagesDao.rx_initializeAllConversations(completion: (AppName.ItemResult<AppName.ConversationModel>)> (), onInitialLoadComplete: ()> ())> () (<compilergenerated>:0)16 AppName 0x00000001002d8748 closure #1 ([AppName.ConversationModel])
> () in closure #3 (Swift.String)> () in AppName.MessagesDao.rx_initializeAllConversations(completion: (AppName.ItemResult<AppName.ConversationModel>)> (), onInitialLoadComplete: ()> ())> () (<compilergenerated>:0)17 AppName 0x000000010030c35c partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed [AppName.ConversationModel]) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed [AppName.ConversationModel])
> (@out (), @error @owned Swift.Error) (<compilergenerated>:0)18 RxSwift 0x0000000102d66ac0 RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01).on(RxSwift.Event) -> () (Map.swift:43)
19 RxSwift 0x0000000102d66c94 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01)<A, B> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)20 RxSwift 0x0000000102d73ad4 partial apply forwarder (:0)
21 RxSwift 0x0000000102d8fd00 partial apply forwarder for reabstraction thunk helper <A1 where A == A1.Element, A1: RxSwift.ObserverType> from @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event) -> () to @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event)
> (@out ()) (<compilergenerated>:0)22 RxSwift 0x0000000102d8ebe8 merged RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC).on(RxSwift.Event) -> () + 112
23 RxSwift 0x0000000102d8e714 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC): RxSwift.ObserverType in RxSwift (<compilergenerated>:0)24 RxSwift 0x0000000102d933b4 RxSwift.Sink.forwardOn(RxSwift.Event<A.Element>) -> () (Sink.swift:34)
25 RxSwift 0x0000000102d6be44 RxSwift.(MergeSinkIter in _DDEA0423368B3B462AE46699A4D080E1).on(RxSwift.Event<B.Element>) -> () (Merge.swift:394)
26 RxSwift 0x0000000102d6bfc8 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(MergeSinkIter in _DDEA0423368B3B462AE46699A4D080E1)<A, B, C> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)27 RxSwift 0x0000000102d64e24 RxSwift.(Just in _BD9B9D4356C4038796FB16D0D54A9F8E).subscribe<A where A == A1.Element, A1: RxSwift.ObserverType>(A1) -> RxSwift.Disposable (Just.swift:83)
28 RxSwift 0x0000000102d6b4dc RxSwift.(MergeSink in _DDEA0423368B3B462AE46699A4D080E1).subscribeInner(RxSwift.Observable<B.Element>) -> () (Merge.swift:477)
29 RxSwift 0x0000000102d6b30c RxSwift.(MergeSink in _DDEA0423368B3B462AE46699A4D080E1).on(RxSwift.Event) -> () (Merge.swift:459)
30 RxSwift 0x0000000102d6c0f4 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(MergeSink in _DDEA0423368B3B462AE46699A4D080E1)<A, B, C> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)31 RxSwift 0x0000000102d933b4 RxSwift.Sink.forwardOn(RxSwift.Event<A.Element>) -> () (Sink.swift:34)
32 RxSwift 0x0000000102d66b4c RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01).on(RxSwift.Event) -> () (Map.swift:44)
33 RxSwift 0x0000000102d66c94 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01)<A, B> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)34 RxSwift 0x0000000102d933b4 RxSwift.Sink.forwardOn(RxSwift.Event<A.Element>) -> () (Sink.swift:34)
35 RxSwift 0x0000000102d5f7b4 RxSwift.(FilterSink in _172A575932639FDD42969ED91F7BE949).on(RxSwift.Event<A.Element>) -> () (Filter.swift:60)
36 RxSwift 0x0000000102d5f8e8 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(FilterSink in _172A575932639FDD42969ED91F7BE949): RxSwift.ObserverType in RxSwift (<compilergenerated>:0)37 RxSwift 0x0000000102d73ad4 partial apply forwarder (:0)
38 RxSwift 0x0000000102d8fd00 partial apply forwarder for reabstraction thunk helper <A1 where A == A1.Element, A1: RxSwift.ObserverType> from @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event) -> () to @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event)
> (@out ()) (<compilergenerated>:0)39 RxSwift 0x0000000102d8ebe8 merged RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC).on(RxSwift.Event) -> () + 112
40 RxSwift 0x0000000102d8e714 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>)
> () in conformance RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC): RxSwift.ObserverType in RxSwift (<compilergenerated>:0)41 RxSwift 0x0000000102d72100 RxSwift.(ObserveOnSink in 277A93ABA8477198C125F3F26B2D4B62).run((), (())
> ())> () (ObserveOn.swift:117)42 RxSwift 0x0000000102d73340 partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@unowned @callee_guaranteed () -> ())
> () to @escaping @callee_guaranteed (@in_guaranteed (), @unowned @callee_guaranteed (@in_guaranteed ())> ())> () (<compilergenerated>:0)43 RxSwift 0x0000000102d81130 partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed A, @unowned @callee_guaranteed (@in_guaranteed A) -> ())
> () to @escaping @callee_guaranteed (@in_guaranteed A, @in_guaranteed @callee_guaranteed (@in_guaranteed A)> (@out ()))> (@out ()) (<compilergenerated>:0)44 RxSwift 0x0000000102d80a68 closure #1 (A) -> RxSwift.Disposable in RxSwift.RecursiveImmediateScheduler.schedule(A)
> () (<compilergenerated>:0)45 RxSwift 0x0000000102d591d8 closure #1 () -> () in RxSwift.DispatchQueueConfiguration.schedule(: A, action: (A)
> RxSwift.Disposable)> RxSwift.Disposable (DispatchQueueConfiguration.swift:27)46 RxSwift 0x0000000102d4c35c reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) ()
> () (<compilergenerated>:0)47 libdispatch.dylib 0x00000001bb2859a8 _dispatch_call_block_and_release + 20
48 libdispatch.dylib 0x00000001bb286524 _dispatch_client_callout + 12
49 libdispatch.dylib 0x00000001bb22ee98 _dispatch_continuation_pop$VARIANT$mp + 408
50 libdispatch.dylib 0x00000001bb22e5ec _dispatch_async_redirect_invoke + 652
51 libdispatch.dylib 0x00000001bb23b438 _dispatch_root_queue_drain + 372
52 libdispatch.dylib 0x00000001bb23bbf8 _dispatch_worker_thread2 + 120
53 libsystem_pthread.dylib 0x00000001bb2d7b38 _pthread_wqthread + 208
54 libsystem_pthread.dylib 0x00000001bb2da740 start_wqthread + 4
The text was updated successfully, but these errors were encountered: