Assertion failed: dest_begin <= m_size
What happened?
We recently received a lot of crash reports regarding native realm errors. Unfortunately I can't reproduce the errors. But from the logs I can tell that it happens when doing realm.RemoveAll<T>();.
Can you see from the logs what's causing this?
Also it would be good if you translate such native exceptions to managed ones. Otherwise we don't have a chance to handle them gracefully.
Repro steps
Didn't manage to reproduce yet.
Version
20.1.0
What Atlas Services are you using?
Local Database only
What type of application is this?
Xamarin
Client OS and version
Android 10 / 13
Code snippets
No response
Stacktrace of the exception/crash you're getting
04-22 14:32:01.102 I/olSecureServic( 4359): Explicit concurrent copying GC freed 13344(718KB) AllocSpace objects, 2(40KB) LOS objects, 58% free, 1069KB/2605KB, paused 186us total 26.392ms
04-22 14:32:01.159 E/REALM ( 9759): /home/runner/work/realm-dotnet/realm-dotnet/wrappers/realm-core/src/realm/array.cpp:312: [realm-core-20.1.2] Assertion failed: dest_begin <= m_size [18446744073709551615, 154]
04-22 14:32:01.159 E/REALM ( 9759): <backtrace not supported on this platform>
04-22 14:32:01.159 E/REALM ( 9759): !!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
04-22 14:32:01.160 F/libc ( 9759): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 9794 (.NET TP Worker), pid 9759 (e.xxxapp)
04-22 14:32:01.310 I/droid.launcher( 8926): Explicit concurrent copying GC freed 9083(602KB) AllocSpace objects, 2(40KB) LOS objects, 49% free, 3186KB/6372KB, paused 228us total 59.025ms
04-22 14:32:01.401 D/incidentd( 1180): WorkDirectory::getReports
04-22 14:32:01.482 I/mmid ( 889): select timeout: wait for receiving msg
04-22 14:32:01.510 I/crash_dump64(11050): obtaining output fd from tombstoned, type: kDebuggerdTombstone
04-22 14:32:01.517 I//system/bin/tombstoned( 1247): received crash request for pid 9794
04-22 14:32:01.519 I/crash_dump64(11050): performing dump of process 9759 (target tid = 9794)
04-22 14:32:01.554 F/DEBUG (11050): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-22 14:32:01.554 F/DEBUG (11050): Build fingerprint: 'Honeywell/CT60/CT60-L0-C:10/90.00.21/0278:user/release-keys'
04-22 14:32:01.555 F/DEBUG (11050): Revision: 'hon660'
04-22 14:32:01.555 F/DEBUG (11050): ABI: 'arm64'
04-22 14:32:01.555 F/DEBUG (11050): Timestamp: 2025-04-22 14:32:01+0200
04-22 14:32:01.555 F/DEBUG (11050): pid: 9759, tid: 9794, name: .NET TP Worker >>> com.xxx.xxxapp <<<
04-22 14:32:01.556 F/DEBUG (11050): uid: 10380
04-22 14:32:01.556 F/DEBUG (11050): signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
04-22 14:32:01.556 F/DEBUG (11050): x0 0000000000000000 x1 0000000000002642 x2 0000000000000006 x3 0000007a7a6877b0
04-22 14:32:01.556 F/DEBUG (11050): x4 7070b12efefeff4c x5 7070b12efefeff4c x6 7070b12efefeff4c x7 7f7fff7f7f7f7f7f
04-22 14:32:01.556 F/DEBUG (11050): x8 00000000000000f0 x9 ed7bf2da63e3c480 x10 0000000000000001 x11 0000000000000000
04-22 14:32:01.556 F/DEBUG (11050): x12 fffffff0fffffbdf x13 ffffffffffffffff x14 0000000000000004 x15 ffffffffffffffff
04-22 14:32:01.556 F/DEBUG (11050): x16 0000007b74a098c0 x17 0000007b749e5970 x18 0000007a7a0d8000 x19 000000000000261f
04-22 14:32:01.556 F/DEBUG (11050): x20 0000000000002642 x21 00000000ffffffff x22 0000000000000138 x23 0000007a7100e2b8
04-22 14:32:01.556 F/DEBUG (11050): x24 0000007a7a6878b8 x25 0000007a4ab28430 x26 0000007a7764b400 x27 00000000401967e0
04-22 14:32:01.556 F/DEBUG (11050): x28 0000007a7a68e020 x29 0000007a7a687850
04-22 14:32:01.556 F/DEBUG (11050): sp 0000007a7a687790 lr 0000007b74997120 pc 0000007b7499714c
04-22 14:32:01.573 I/rol.androidwor( 2477): Explicit concurrent copying GC freed 79891(4348KB) AllocSpace objects, 46(804KB) LOS objects, 49% free, 11MB/22MB, paused 190us total 159.125ms
04-22 14:32:01.729 I/roidplusServic( 4815): Explicit concurrent copying GC freed 6835(244KB) AllocSpace objects, 3(60KB) LOS objects, 60% free, 1018KB/2554KB, paused 183us total 29.426ms
04-22 14:32:01.786 F/DEBUG (11050):
04-22 14:32:01.786 F/DEBUG (11050): backtrace:
04-22 14:32:01.786 F/DEBUG (11050): #00 pc 000000000008314c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: fa218814e858c02f4891981f2ae3cdf1)
04-22 14:32:01.786 F/DEBUG (11050): #01 pc 00000000005d669c /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #02 pc 00000000005d67fc /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #03 pc 00000000005d6760 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #04 pc 00000000005d66ac /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #05 pc 0000000000417ed0 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #06 pc 00000000005242c0 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #07 pc 00000000004587b4 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #08 pc 0000000000459c74 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #09 pc 00000000005391a0 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #10 pc 00000000004598e0 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #11 pc 0000000000571094 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #12 pc 0000000000570ff0 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #13 pc 00000000005702bc /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #14 pc 00000000005701fc /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #15 pc 00000000005ac728 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #16 pc 000000000054b94c /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #17 pc 00000000005ab9e0 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #18 pc 000000000054b2dc /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #19 pc 000000000054b1a4 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.786 F/DEBUG (11050): #20 pc 00000000005ae488 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.787 F/DEBUG (11050): #21 pc 000000000044a2bc /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.787 F/DEBUG (11050): #22 pc 0000000000424820 /data/app/com.xxx.xxxapp-vyYWnFDyYo5RdN740lAo5A==/lib/arm64/librealm-wrappers.so (results_clear+72) (BuildId: 839d24baf379e2e8e7e6ebfde87962e705e7e636)
04-22 14:32:01.787 F/DEBUG (11050): #23 pc 000000000002dd6c <anonymous:7adb18d000>
Relevant log output
we also see a lot of exceptions like this in our crash reports (might be related): Realms.Exceptions.RealmFileAccessErrorException: Failed to create ExternalCommitHelper: Invalid argument at Realms.NativeException.ThrowIfNecessary() in Realm.dll:token 0x600041c+0xf at Realms.SharedRealmHandle.Open(Configuration configuration) in Realm.dll:token 0x600036d+0x8 at Realms.RealmConfiguration.CreateHandle(Configuration& configuration) in Realm.dll:token 0x6000027+0x0 at Realms.RealmConfigurationBase.CreateRealm() in Realm.dll:token 0x6000040+0x15 at Realms.Realm.GetInstance(RealmConfigurationBase config) in Realm.dll:token 0x6000427+0xa
According to the logs these exceptions occur on concurrent access of a realm db. We tried to delete and recreate the realm when this happens - but for what ever reason the exception reoccurs on the newly created realm as well.