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

[Bug]: Crash when using Realm.Remove #2977

Closed
tomkrikorian opened this issue Jul 26, 2022 · 15 comments
Closed

[Bug]: Crash when using Realm.Remove #2977

tomkrikorian opened this issue Jul 26, 2022 · 15 comments
Assignees
Labels
More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@tomkrikorian
Copy link
Contributor

tomkrikorian commented Jul 26, 2022

What happened?

Using Realm.Remove makes the app crash.
We are using a PartitionSyncConfiguration for our realm. Sync is enabled without developer mode.

Repro steps

See code snippets but don't really have steps to repro, only using remove makes the app crash.

Version

10.14.0

What SDK flavour are you using?

MongoDB Atlas (i.e. Sync, auth, functions)

What type of application is this?

Unity

Client OS and version

iOS 15.5

Code snippets

		realm.Write(() =>
		{
			foreach (Composition composition in compositions)
			{
				realm.Remove(composition);
			}
		});

Stacktrace of the exception/crash you're getting

#20	0x000000012a7b7618 in ::NativeMethods_remove_mD0824EEFB5433EC1876B4977A9D7AA80379C0359(ObjectHandle_t6E2E2554AB8A7C31404F69AAF66874FB73D61A82 *, SharedRealmHandle_tED5EB4410B8F935E5C2A6F0CEB55311592DED0A4 *, NativeException_tA3BA5D4F9F4A5AE2F0A1EBA515B197049C064B7D *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Realm4.cpp:51854
#21	0x000000012a74ca38 in ::ObjectHandle_RemoveFromRealm_m5706BE2EEE4DB56CDE5C0E7FE9B92FD29D36E94A(ObjectHandle_t6E2E2554AB8A7C31404F69AAF66874FB73D61A82 *, SharedRealmHandle_tED5EB4410B8F935E5C2A6F0CEB55311592DED0A4 *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Realm2.cpp:35753
#22	0x000000012a77593c in ::Realm_Remove_mCA825F1557DEA055E03643B9E120D0A9033D6E84(Realm_t911B77697181790EF1916BCE2C40FA72FCBC2DB9 *, RealmObjectBase_tA5013D5B08A056F0A4C754412E5F4BBADA8A6F30 *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Realm3.cpp:25085
#23	0x000000012a6189ec in ::U3CU3Ec__DisplayClass33_0_U3CCleanU3Eb__1_m219D68CCA1FC25791A1DFEF429DD1F2DEAEF4A14(U3CU3Ec__DisplayClass33_0_tE08000494D3F8202CB29CD225BAF0CA5B56B7D8E *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Opuscope.Core.Runtime4.cpp:46137
#24	0x000000012bdb9e8c in ::Action_Invoke_m3FFA5BE3D64F0FF8E1E1CB6F953913FADB5EB89E(Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6 *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/mscorlib.cpp:22621
#25	0x000000012a7cf9c4 in ::U3CU3Ec__DisplayClass66_0_U3CWriteU3Eb__0_mEA582548D887BF13C6EFCEC98AEAFF88D6076C18(U3CU3Ec__DisplayClass66_0_tE2C2D09F3F6ACF02F2E4A93D69A21CE87F092A64 *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Realm4.cpp:65730
#26	0x0000000129383224 in ::Func_1_Invoke_mCA605B0373C1EE39807AB82AEA983289D3F15C79_gshared(Func_1_t76FCDA5C58178ED310C472967481FDE5F47DCF0F *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Generics37.cpp:15487
#27	0x0000000128aa08a4 in ::Realm_Write_TisBoolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_m992352FF023C3B7E3D62E664B92A3319CBC46BF0_gshared(Realm_t911B77697181790EF1916BCE2C40FA72FCBC2DB9 *, Func_1_t76FCDA5C58178ED310C472967481FDE5F47DCF0F *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/GenericMethods20.cpp:35345
#28	0x0000000126b9c0b4 in Realm_Write_TisBoolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_m992352FF023C3B7E3D62E664B92A3319CBC46BF0(Realm_t911B77697181790EF1916BCE2C40FA72FCBC2DB9*, Func_1_t76FCDA5C58178ED310C472967481FDE5F47DCF0F*, MethodInfo const*) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Realm3.cpp:18492
#29	0x000000012a775804 in ::Realm_Write_m197C10E8109F59A56AE8BB984A8C6E97190AC477(Realm_t911B77697181790EF1916BCE2C40FA72FCBC2DB9 *, Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6 *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Realm3.cpp:25056
#30	0x000000012a6196d0 in ::U3CCleanU3Ed__33_MoveNext_m59F5CCAAF744A61C3352B15823DB2645703C1059(U3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38 *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Opuscope.Core.Runtime4.cpp:46434
#31	0x00000001263d732c in InterfaceActionInvoker0::Invoke(unsigned short, Il2CppClass*, Il2CppObject*) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/AVProVideo.Runtime.cpp:97
#32	0x0000000128b0bbac in AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inline(AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6*, Il2CppObject**, MethodInfo const*) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/GenericMethods22.cpp:53144
#33	0x0000000126b1da14 in AsyncUniTaskMethodBuilder_Start_TisU3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38_mE71E1EC4A6DA057436D21370081E9CE22CBAEC6C_inline(AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6*, U3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38**, MethodInfo const*) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Opuscope.Core.Runtime2.cpp:33568
#34	0x000000012a580350 in ::SharedCompositionManager_Clean_m9F56244B1FEA8DD4EED6431BDCEB647E45EBE64D(SharedCompositionManager_t13169510B75DFE4460D422F70B7E941124BB28A8 *, RuntimeObject *, const RuntimeMethod *) at /Users/tomkrikorian/Documents/git/rainbow/src/Client.Core/UnityProject/iosBuild/Classes/Native/Opuscope.Core.Runtime2.cpp:37107

Relevant log output

/Users/runner/work/realm-dotnet/realm-dotnet/wrappers/realm-core/src/realm/array_backlink.cpp:108: [realm-core-12.1.0] Assertion failed: int64_t(value >> 1) == key.value [258, 2]
0   realm-wrappers                      0x0000000112143be0 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   realm-wrappers                      0x0000000112143b28 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 328
2   realm-wrappers                      0x00000001120568a0 _ZN5realm11GroupWriter14write_array_atEPNS0_9MapWindowEmPKcm + 0
3   realm-wrappers                      0x0000000112009850 _ZN5realm13ArrayBacklink6removeEmNS_6ObjKeyE + 512
4   realm-wrappers                      0x000000011209af1c _ZN5realm3Obj19remove_one_backlinkENS_6ColKeyENS_6ObjKeyE + 300
5   realm-wrappers                      0x000000011209c10c _ZNK5realm3Obj15remove_backlinkENS_6ColKeyENS_7ObjLinkERNS_12CascadeStateE + 280
6   realm-wrappers                      0x0000000112046ed8 _ZNK5realm10Dictionary16remove_backlinksERNS_12CascadeStateE + 200
7   realm-wrappers                      0x0000000112023910 _ZZN5realm4util11FunctionRefIFbNS_6ColKeyEEEC1IRZNS_7Cluster5eraseENS_6ObjKeyERNS_12CascadeStateEE3$_3EEOT_ENUlPvS2_E_8__invokeESE_S2_ + 892
8   realm-wrappers                      0x0000000112122124 _ZNK5realm16TableClusterTree25for_each_and_every_columnENS_4util11FunctionRefIFbNS_6ColKeyEEEE + 84
9   realm-wrappers                      0x000000011201d1f4 _ZN5realm7Cluster5eraseENS_6ObjKeyERNS_12CascadeStateE + 160
10  realm-wrappers                      0x000000011202e1b4 _ZZN5realm16ClusterNodeInner5eraseENS_6ObjKeyERNS_12CascadeStateEENK3$_3clEPNS_11ClusterNodeERNS0_9ChildInfoE + 68
11  realm-wrappers                      0x000000011202a3b4 _ZN5realm16ClusterNodeInner5eraseENS_6ObjKeyERNS_12CascadeStateE + 236
12  realm-wrappers                      0x000000011202cf48 _ZN5realm11ClusterTree5eraseENS_6ObjKeyERNS_12CascadeStateE + 128
13  realm-wrappers                      0x000000011210b364 _ZN5realm5Table16remove_recursiveERNS_12CascadeStateE + 404
14  realm-wrappers                      0x0000000112117d50 _ZN5realm5Table13remove_objectENS_6ObjKeyE + 216
15  realm-wrappers                      0x0000000111dbb12c object_remove + 80
16  UnityFramework                      0x000000012a7b7618 NativeMethods_remove_mD0824EEFB5433EC1876B4977A9D7AA80379C0359 + 188
17  UnityFramework                      0x000000012a74ca38 ObjectHandle_RemoveFromRealm_m5706BE2EEE4DB56CDE5C0E7FE9B92FD29D36E94A + 88
18  UnityFramework                      0x000000012a77593c Realm_Remove_mCA825F1557DEA055E03643B9E120D0A9033D6E84 + 292
19  UnityFramework                      0x000000012a6189ec U3CU3Ec__DisplayClass33_0_U3CCleanU3Eb__1_m219D68CCA1FC25791A1DFEF429DD1F2DEAEF4A14 + 312
20  UnityFramework                      0x000000012bdb9e8c Action_Invoke_m3FFA5BE3D64F0FF8E1E1CB6F953913FADB5EB89E + 316
21  UnityFramework                      0x000000012a7cf9c4 U3CU3Ec__DisplayClass66_0_U3CWriteU3Eb__0_mEA582548D887BF13C6EFCEC98AEAFF88D6076C18 + 52
22  UnityFramework                      0x0000000129383224 Func_1_Invoke_mCA605B0373C1EE39807AB82AEA983289D3F15C79_gshared + 336
23  UnityFramework                      0x0000000128aa08a4 Realm_Write_TisBoolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_m992352FF023C3B7E3D62E664B92A3319CBC46BF0_gshared + 284
24  UnityFramework                      0x0000000126b9c0b4 _Z106Realm_Write_TisBoolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_m992352FF023C3B7E3D62E664B92A3319CBC46BF0P47Realm_t911B77697181790EF1916BCE2C40FA72FCBC2DB9P48Func_1_t76FCDA5C58178ED310C472967481FDE5F47DCF0FPK10MethodInfo + 40
25  UnityFramework                      0x000000012a775804 Realm_Write_m197C10E8109F59A56AE8BB984A8C6E97190AC477 + 356
26  UnityFramework                      0x000000012a6196d0 U3CCleanU3Ed__33_MoveNext_m59F5CCAAF744A61C3352B15823DB2645703C1059 + 2184
27  UnityFramework                      0x00000001263d732c _ZN23InterfaceActionInvoker06InvokeEtP11Il2CppClassP12Il2CppObject + 304
28  UnityFramework                      0x0000000128b0bbac _Z105AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP12Il2CppObjectPK10MethodInfo + 116
29  UnityFramework                      0x0000000126b1da14 _Z142AsyncUniTaskMethodBuilder_Start_TisU3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38_mE71E1EC4A6DA057436D21370081E9CE22CBAEC6C_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP58U3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38PK10MethodInfo + 40
30  UnityFramework                      0x000000012a580350 SharedCompositionManager_Clean_m9F56244B1FEA8DD4EED6431BDCEB647E45EBE64D + 504
31  UnityFramework                      0x000000012a61a354 U3CCleanAllU3Ed__36_MoveNext_m430EC4CEB7A4B1B6DBE0F596658EE5BEA6EAA7B9 + 1364
32  UnityFramework                      0x00000001263d732c _ZN23InterfaceActionInvoker06InvokeEtP11Il2CppClassP12Il2CppObject + 304
33  UnityFramework                      0x0000000128b0bbac _Z105AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP12Il2CppObjectPK10MethodInfo + 116
34  UnityFramework                      0x0000000126b1de24 _Z145AsyncUniTaskMethodBuilder_Start_TisU3CCleanAllU3Ed__36_t022BB976AADB9ABE3875AB56AA0024073E4A1AE1_m127BA3FB1DC22E32E63D4CA74FF30A834AC3D0AC_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP61U3CCleanAllU3Ed__36_t022BB976AADB9ABE3875AB56AA0024073E4A1AE1PK10MethodInfo + 40
35  UnityFramework                      0x000000012a58105c SharedCompositionManager_CleanAll_m7DB087CC520F8C2B7E63C42D3D98E2A16C8392C3 + 504
36  UnityFramework                      0x000000012a581878 SharedCompositionManager_DeleteCompositions_m4F35A760E93470E7D37BFED4B17C72CB2E2AC0D4 + 1480
37  UnityFramework                      0x0000000126b098b8 _ZN23InterfaceActionInvoker1IP56ObjectIdU5BU5D_t91C1E350C27E1142959827C7451965DE83A07155E6InvokeEtP11Il2CppClassP12Il2CppObjectS1_ + 312
38  UnityFramework                      0x000000012a5f48f0 U3CU3Ec_U3CDeleteCompositionsU3Eb__30_0_mF16D3D95FF44531A8A6D78EB0617A127AEEB95BB + 1164
39  UnityFramework                      0x00000001293cfad4 Func_3_Invoke_m306303E5E2BE2BD0D580FFBF589A5601E1C46DD1_gshared + 940
40  UnityFramework                      0x0000000128fc6034 U3CRunU3Ed__9_2_MoveNext_m1B09AD21E6720CDE0F08822575B1FB1A0EDEABA8_gshared + 1756
41  UnityFramework                      0x00000001263d732c _ZN23InterfaceActionInvoker06InvokeEtP11Il2CppClassP12Il2CppObject + 304
42  UnityFramework                      0x0000000128b0bbac _Z105AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP12Il2CppObjectPK10MethodInfo + 116
43  UnityFramework                      0x000000012643c938 _Z141AsyncUniTaskMethodBuilder_Start_TisU3CRunU3Ed__9_2_tF077BFEC9CAA4A834E7251558DCBFCDBBE556DB3_m8C5DC8CC402F1C0A91AAAB8BB9CAA259A16D368E_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP57U3CRunU3Ed__9_2_tF077BFEC9CAA4A834E7251558DCBFCDBBE556DB3PK10MethodInfo + 40
44  UnityFramework                      0x0000000128af190c WorkflowManager_Run_TisRuntimeObject_TisRuntimeObject_m0F52DA5FEA2E7E5DA33F567523A957E6CA1D5E0A_gshared + 592
45  UnityFramework                      0x0000000128af15c0 WorkflowManager_Register_TisRuntimeObject_TisRuntimeObject_mE01688077FD318F410256A1D569231B6029C8298_gshared + 660
46  UnityFramework                      0x0000000128af100c WorkflowManager_Register_TisRuntimeObject_TisRuntimeObject_mB05EDFF2C30CC54919AD12B1368F1FA8B919CC26_gshared + 332
47  UnityFramework                      0x0000000128af0eb4 WorkflowManager_Register_TisRuntimeObject_TisRuntimeObject_mE24F4789D7300AEC9CF9A14ACC0D996EFF5F7920_gshared + 492
48  UnityFramework                      0x0000000126b12b10 _Z196WorkflowManager_Register_TisCompositionIdentifierPayload_tE1AE53C38019C3512F5091614A900791E5F3ACE8_TisVoidResult_t000E1330D10C866ADF396AABF50F1FF89804185A_mAD57C363066E554A140ADF1D03E983C47DD3E3CEP57WorkflowManager_t99DF2C49324FFD56B93140B25426847D80C69159P8String_tP48Func_3_t9BA6CC9F00196B44E1D47FD1F3C7822BE8524568PK10MethodInfo + 48
49  UnityFramework                      0x000000012a543718 NativeBridge_DeleteCompositions_mDE519D52B7B88193AED734D6B4841C1B7D2C5359 + 580
50  UnityFramework                      0x00000001269cf630 _Z79RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5_RuntimeObjectPFvvEPK10MethodInfoPvPS4_S4_ + 56
51  UnityFramework                      0x00000001284a2e54 _ZN6il2cpp2vm7Runtime15InvokeWithThrowEPK10MethodInfoPvPS5_ + 96
52  UnityFramework                      0x00000001284a2cb8 _ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException + 100
53  UnityFramework                      0x0000000127c229dc _Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb + 112
54  UnityFramework                      0x0000000127c32268 _ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb + 140
55  UnityFramework                      0x0000000127c43c60 _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr + 2156
56  UnityFramework                      0x0000000127c43ef0 _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr + 84
57  UnityFramework                      0x0000000127c33128 _ZN9Scripting20SendScriptingMessageER10GameObjectPKc18ScriptingObjectPtr + 424
58  UnityFramework                      0x000000012759ce18 _ZN12WebScripting19ProcessSendMessagesEv + 156
59  UnityFramework                      0x00000001279678a0 _ZZ23InitPlayerLoopCallbacksvEN47PostLateUpdateProcessWebSendMessagesRegistrator7ForwardEv + 56
60  UnityFramework                      0x000000012795e630 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 100
61  UnityFramework                      0x000000012795e670 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 164
62  UnityFramework                      0x000000012795e9c8 _Z10PlayerLoopv + 316
63  UnityFramework                      0x000000012801e048 _ZL19UnityPlayerLoopImplb + 116
64  UnityFramework                      0x00000001263c6c4c UnityRepaint + 28
65  UnityFramework                      0x00000001263c6c20 -[UnityAppController(Rendering) repaint] + 120
66  UnityFramework                      0x00000001263c6b64 -[UnityAppController(Rendering) repaintDisplayLink] + 132
67  QuartzCore                          0x00000001b1674d40 AA75B503-9DA1-3696-A32F-7A600DED98A9 + 68928
68  QuartzCore                          0x00000001b17cfc60 AA75B503-9DA1-3696-A32F-7A600DED98A9 + 1490016
69  UIKitCore                           0x00000001b057a97c 3ED35565-456D-33CB-B554-6C567FA81585 + 8227196
70  UIKitCore                           0x00000001b0c00c48 3ED35565-456D-33CB-B554-6C567FA81585 + 15068232
71  UIKitCore                           0x00000001b0c00410 3ED35565-456D-33CB-B554-6C567FA81585 + 15066128
72  CoreFoundation                      0x00000001ad9e3414 5198FB57-5645-3B34-A49F-F32B52256CF3 + 766996
73  CoreFoundation                      0x00000001ad9f41a0 5198FB57-5645-3B34-A49F-F32B52256CF3 + 836000
74  CoreFoundation                      0x00000001ad92d694 5198FB57-5645-3B34-A49F-F32B52256CF3 + 22164
75  CoreFoundation                      0x00000001ad93305c 5198FB57-5645-3B34-A49F-F32B52256CF3 + 45148
76  CoreFoundation                      0x00000001ad946bc8 CFRunLoopRunSpecific + 600
77  GraphicsServices                    0x00000001c9a7a374 GSEventRunModal + 164
78  UIKitCore                           0x00000001b02b6648 3ED35565-456D-33CB-B554-6C567FA81585 + 5326408
79  UIKitCore                           0x00000001b0037d90 UIApplicationMain + 364
80  libswiftUIKit.dylib                 0x00000001c56b3ecc $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 104
81  NativeiOSApp                        0x0000000104a21730 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 104
82  NativeiOSApp                        0x0000000104a216b8 $s12NativeiOSApp11AppDelegateC5$mainyyFZ + 44
83  NativeiOSApp                        0x0000000104a321a0 main + 28
84  dyld                                0x000000010aa59ce4 start + 520!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2022-07-26 16:43:49.438725+0200 NativeiOSApp[13042:697584] /Users/runner/work/realm-dotnet/realm-dotnet/wrappers/realm-core/src/realm/array_backlink.cpp:108: [realm-core-12.1.0] Assertion failed: int64_t(value >> 1) == key.value [258, 2]
0   realm-wrappers                      0x0000000112143be0 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   realm-wrappers                      0x0000000112143b28 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 328
2   realm-wrappers                      0x00000001120568a0 _ZN5realm11GroupWriter14write_array_atEPNS0_9MapWindowEmPKcm + 0
3   realm-wrappers                      0x0000000112009850 _ZN5realm13ArrayBacklink6removeEmNS_6ObjKeyE + 512
4   realm-wrappers                      0x000000011209af1c _ZN5realm3Obj19remove_one_backlinkENS_6ColKeyENS_6ObjKeyE + 300
5   realm-wrappers                      0x000000011209c10c _ZNK5realm3Obj15remove_backlinkENS_6ColKeyENS_7ObjLinkERNS_12CascadeStateE + 280
6   realm-wrappers                      0x0000000112046ed8 _ZNK5realm10Dictionary16remove_backlinksERNS_12CascadeStateE + 200
7   realm-wrappers                      0x0000000112023910 _ZZN5realm4util11FunctionRefIFbNS_6ColKeyEEEC1IRZNS_7Cluster5eraseENS_6ObjKeyERNS_12CascadeStateEE3$_3EEOT_ENUlPvS2_E_8__invokeESE_S2_ + 892
8   realm-wrappers                      0x0000000112122124 _ZNK5realm16TableClusterTree25for_each_and_every_columnENS_4util11FunctionRefIFbNS_6ColKeyEEEE + 84
9   realm-wrappers                      0x000000011201d1f4 _ZN5realm7Cluster5eraseENS_6ObjKeyERNS_12CascadeStateE + 160
10  realm-wrappers                      0x000000011202e1b4 _ZZN5realm16ClusterNodeInner5eraseENS_6ObjKeyERNS_12CascadeStateEENK3$_3clEPNS_11ClusterNodeERNS0_9ChildInfoE + 68
11  realm-wrappers                      0x000000011202a3b4 _ZN5realm16ClusterNodeInner5eraseENS_6ObjKeyERNS_12CascadeStateE + 236
12  realm-wrappers                      0x000000011202cf48 _ZN5realm11ClusterTree5eraseENS_6ObjKeyERNS_12CascadeStateE + 128
13  realm-wrappers                      0x000000011210b364 _ZN5realm5Table16remove_recursiveERNS_12CascadeStateE + 404
14  realm-wrappers                      0x0000000112117d50 _ZN5realm5Table13remove_objectENS_6ObjKeyE + 216
15  realm-wrappers                      0x0000000111dbb12c object_remove + 80
16  UnityFramework                      0x000000012a7b7618 NativeMethods_remove_mD0824EEFB5433EC1876B4977A9D7AA80379C0359 + 188
17  UnityFramework                      0x000000012a74ca38 ObjectHandle_RemoveFromRealm_m5706BE2EEE4DB56CDE5C0E7FE9B92FD29D36E94A + 88
18  UnityFramework                      0x000000012a77593c Realm_Remove_mCA825F1557DEA055E03643B9E120D0A9033D6E84 + 292
19  UnityFramework                      0x000000012a6189ec U3CU3Ec__DisplayClass33_0_U3CCleanU3Eb__1_m219D68CCA1FC25791A1DFEF429DD1F2DEAEF4A14 + 312
20  UnityFramework                      0x000000012bdb9e8c Action_Invoke_m3FFA5BE3D64F0FF8E1E1CB6F953913FADB5EB89E + 316
21  UnityFramework                      0x000000012a7cf9c4 U3CU3Ec__DisplayClass66_0_U3CWriteU3Eb__0_mEA582548D887BF13C6EFCEC98AEAFF88D6076C18 + 52
22  UnityFramework                      0x0000000129383224 Func_1_Invoke_mCA605B0373C1EE39807AB82AEA983289D3F15C79_gshared + 336
23  UnityFramework                      0x0000000128aa08a4 Realm_Write_TisBoolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_m992352FF023C3B7E3D62E664B92A3319CBC46BF0_gshared + 284
24  UnityFramework                      0x0000000126b9c0b4 _Z106Realm_Write_TisBoolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_m992352FF023C3B7E3D62E664B92A3319CBC46BF0P47Realm_t911B77697181790EF1916BCE2C40FA72FCBC2DB9P48Func_1_t76FCDA5C58178ED310C472967481FDE5F47DCF0FPK10MethodInfo + 40
25  UnityFramework                      0x000000012a775804 Realm_Write_m197C10E8109F59A56AE8BB984A8C6E97190AC477 + 356
26  UnityFramework                      0x000000012a6196d0 U3CCleanU3Ed__33_MoveNext_m59F5CCAAF744A61C3352B15823DB2645703C1059 + 2184
27  UnityFramework                      0x00000001263d732c _ZN23InterfaceActionInvoker06InvokeEtP11Il2CppClassP12Il2CppObject + 304
28  UnityFramework                      0x0000000128b0bbac _Z105AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP12Il2CppObjectPK10MethodInfo + 116
29  UnityFramework                      0x0000000126b1da14 _Z142AsyncUniTaskMethodBuilder_Start_TisU3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38_mE71E1EC4A6DA057436D21370081E9CE22CBAEC6C_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP58U3CCleanU3Ed__33_tE9C0EF09EC37899801CE5B37251729DC047DCF38PK10MethodInfo + 40
30  UnityFramework                      0x000000012a580350 SharedCompositionManager_Clean_m9F56244B1FEA8DD4EED6431BDCEB647E45EBE64D + 504
31  UnityFramework                      0x000000012a61a354 U3CCleanAllU3Ed__36_MoveNext_m430EC4CEB7A4B1B6DBE0F596658EE5BEA6EAA7B9 + 1364
32  UnityFramework                      0x00000001263d732c _ZN23InterfaceActionInvoker06InvokeEtP11Il2CppClassP12Il2CppObject + 304
33  UnityFramework                      0x0000000128b0bbac _Z105AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP12Il2CppObjectPK10MethodInfo + 116
34  UnityFramework                      0x0000000126b1de24 _Z145AsyncUniTaskMethodBuilder_Start_TisU3CCleanAllU3Ed__36_t022BB976AADB9ABE3875AB56AA0024073E4A1AE1_m127BA3FB1DC22E32E63D4CA74FF30A834AC3D0AC_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP61U3CCleanAllU3Ed__36_t022BB976AADB9ABE3875AB56AA0024073E4A1AE1PK10MethodInfo + 40
35  UnityFramework                      0x000000012a58105c SharedCompositionManager_CleanAll_m7DB087CC520F8C2B7E63C42D3D98E2A16C8392C3 + 504
36  UnityFramework                      0x000000012a581878 SharedCompositionManager_DeleteCompositions_m4F35A760E93470E7D37BFED4B17C72CB2E2AC0D4 + 1480
37  UnityFramework                      0x0000000126b098b8 _ZN23InterfaceActionInvoker1IP56ObjectIdU5BU5D_t91C1E350C27E1142959827C7451965DE83A07155E6InvokeEtP11Il2CppClassP12Il2CppObjectS1_ + 312
38  UnityFramework                      0x000000012a5f48f0 U3CU3Ec_U3CDeleteCompositionsU3Eb__30_0_mF16D3D95FF44531A8A6D78EB0617A127AEEB95BB + 1164
39  UnityFramework                      0x00000001293cfad4 Func_3_Invoke_m306303E5E2BE2BD0D580FFBF589A5601E1C46DD1_gshared + 940
40  UnityFramework                      0x0000000128fc6034 U3CRunU3Ed__9_2_MoveNext_m1B09AD21E6720CDE0F08822575B1FB1A0EDEABA8_gshared + 1756
41  UnityFramework                      0x00000001263d732c _ZN23InterfaceActionInvoker06InvokeEtP11Il2CppClassP12Il2CppObject + 304
42  UnityFramework                      0x0000000128b0bbac _Z105AsyncUniTaskMethodBuilder_Start_TisRuntimeObject_m4768DDF2B8E83B27D8654DB8246ED9F40435D2F9_gshared_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP12Il2CppObjectPK10MethodInfo + 116
43  UnityFramework                      0x000000012643c938 _Z141AsyncUniTaskMethodBuilder_Start_TisU3CRunU3Ed__9_2_tF077BFEC9CAA4A834E7251558DCBFCDBBE556DB3_m8C5DC8CC402F1C0A91AAAB8BB9CAA259A16D368E_inlineP67AsyncUniTaskMethodBuilder_t495936A951BCC81F447818FAEFB46EA4E1D243F6PP57U3CRunU3Ed__9_2_tF077BFEC9CAA4A834E7251558DCBFCDBBE556DB3PK10MethodInfo + 40
44  UnityFramework                      0x0000000128af190c WorkflowManager_Run_TisRuntimeObject_TisRuntimeObject_m0F52DA5FEA2E7E5DA33F567523A957E6CA1D5E0A_gshared + 592
45  UnityFramework                      0x0000000128af15c0 WorkflowManager_Register_TisRuntimeObject_TisRuntimeObject_mE01688077FD318F410256A1D569231B6029C8298_gshared + 660
46  UnityFramework                      0x0000000128af100c WorkflowManager_Register_TisRuntimeObject_TisRuntimeObject_mB05EDFF2C30CC54919AD12B1368F1FA8B919CC26_gshared + 332
47  UnityFramework                      0x0000000128af0eb4 WorkflowManager_Register_TisRuntimeObject_TisRuntimeObject_mE24F4789D7300AEC9CF9A14ACC0D996EFF5F7920_gshared + 492
48  UnityFramework                      0x0000000126b12b10 _Z196WorkflowManager_Register_TisCompositionIdentifierPayload_tE1AE53C38019C3512F5091614A900791E5F3ACE8_TisVoidResult_t000E1330D10C866ADF396AABF50F1FF89804185A_mAD57C363066E554A140ADF1D03E983C47DD3E3CEP57WorkflowManager_t99DF2C49324FFD56B93140B25426847D80C69159P8String_tP48Func_3_t9BA6CC9F00196B44E1D47FD1F3C7822BE8524568PK10MethodInfo + 48
49  UnityFramework                      0x000000012a543718 NativeBridge_DeleteCompositions_mDE519D52B7B88193AED734D6B4841C1B7D2C5359 + 580
50  UnityFramework                      0x00000001269cf630 _Z79RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5_RuntimeObjectPFvvEPK10MethodInfoPvPS4_S4_ + 56
51  UnityFramework                      0x00000001284a2e54 _ZN6il2cpp2vm7Runtime15InvokeWithThrowEPK10MethodInfoPvPS5_ + 96
52  UnityFramework                      0x00000001284a2cb8 _ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException + 100
53  UnityFramework                      0x0000000127c229dc _Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb + 112
54  UnityFramework                      0x0000000127c32268 _ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb + 140
55  UnityFramework                      0x0000000127c43c60 _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr + 2156
56  UnityFramework                      0x0000000127c43ef0 _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr + 84
57  UnityFramework                      0x0000000127c33128 _ZN9Scripting20SendScriptingMessageER10GameObjectPKc18ScriptingObjectPtr + 424
58  UnityFramework                      0x000000012759ce18 _ZN12WebScripting19ProcessSendMessagesEv + 156
59  UnityFramework                      0x00000001279678a0 _ZZ23InitPlayerLoopCallbacksvEN47PostLateUpdateProcessWebSendMessagesRegistrator7ForwardEv + 56
60  UnityFramework                      0x000000012795e630 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 100
61  UnityFramework                      0x000000012795e670 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 164
62  UnityFramework                      0x000000012795e9c8 _Z10PlayerLoopv + 316
63  UnityFramework                      0x000000012801e048 _ZL19UnityPlayerLoopImplb + 116
64  UnityFramework                      0x00000001263c6c4c UnityRepaint + 28
65  UnityFramework                      0x00000001263c6c20 -[UnityAppController(Rendering) repaint] + 120
66  UnityFramework                      0x00000001263c6b64 -[UnityAppController(Rendering) repaintDisplayLink] + 132
67  QuartzCore                          0x00000001b1674d40 AA75B503-9DA1-3696-A32F-7A600DED98A9 + 68928
68  QuartzCore                          0x00000001b17cfc60 AA75B503-9DA1-3696-A32F-7A600DED98A9 + 1490016
69  UIKitCore                           0x00000001b057a97c 3ED35565-456D-33CB-B554-6C567FA81585 + 8227196
70  UIKitCore                           0x00000001b0c00c48 3ED35565-456D-33CB-B554-6C567FA81585 + 15068232
71  UIKitCore                           0x00000001b0c00410 3ED35565-456D-33CB-B554-6C567FA81585 + 15066128
72  CoreFoundation                      0x00000001ad9e3414 5198FB57-5645-3B34-A49F-F32B52256CF3 + 766996
73  CoreFoundation                      0x00000001ad9f41a0 5198FB57-5645-3B34-A49F-F32B52256CF3 + 836000
74  CoreFoundation                      0x00000001ad92d694 5198FB57-5645-3B34-A49F-F32B52256CF3 + 22164
75  CoreFoundation                      0x00000001ad93305c 5198FB57-5645-3B34-A49F-F32B52256CF3 + 45148
76  CoreFoundation                      0x00000001ad946bc8 CFRunLoopRunSpecific + 600
77  GraphicsServices                    0x00000001c9a7a374 GSEventRunModal + 164
78  UIKitCore                           0x00000001b02b6648 3ED35565-456D-33CB-B554-6C567FA81585 + 5326408
79  UIKitCore                           0x00000001b0037d90 UIApplicationMain + 364
80  libswiftUIKit.dylib                 0x00000001c56b3ecc $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 104
81  NativeiOSApp                        0x0000000104a21730 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 104
82  NativeiOSApp                        0x0000000104a216b8 $s12NativeiOSApp11AppDelegateC5$mainyyFZ + 44
83  NativeiOSApp                        0x0000000104a321a0 main + 28
84  dyld                                0x000000010aa59ce4 start + 520!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
@fealebenpae
Copy link
Member

Hey @tomkrikorian, thanks for reporting this.
Can you share the schema of your app? A small Xamarin or console app project that reproduces the problem would also be invaluable.

@tomkrikorian
Copy link
Contributor Author

Do you have an email address i can send the schema privately ?
Not sure i'll be able to provide a xamarin / console app, i'll check with our dev team.

@fealebenpae
Copy link
Member

fealebenpae commented Jul 27, 2022

You can email it to help@realm.io and mention realm-dotnet#2977 in the subject line.

@polskais1
Copy link

I'm getting a similar crash on Realm.Remove roughly every 1 in 15 invocations

Realm SDK version is latest (10.15.1) and I'm seeing the issue in the Unity Windows editor (2021.3.6f1)

Here's my crash log if it's any help:

Asset Pipeline Refresh: Total: 0.093 seconds - Initiated by RefreshV2(AllowForceSynchronousImport)
2022-08-09 15:35:19.726 Info: Realm: Force closing all native instances: Application is exiting
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
UnityUtils.UnityLogger:LogImpl (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:Log (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:LogDefault (Realms.Logging.LogLevel,string)
Realms.NativeCommon:CleanupNativeResources (string)
UnityUtils.Initializer/<>c:<Initialize>b__1_0 ()
UnityEngine.Application:Internal_ApplicationQuit ()

2022-08-09 15:35:19.734 Info: Realm: Closed all native instances in 7 ms.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
UnityUtils.UnityLogger:LogImpl (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:Log (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:LogDefault (Realms.Logging.LogLevel,string)
Realms.NativeCommon:CleanupNativeResources (string)
UnityUtils.Initializer/<>c:<Initialize>b__1_0 ()
UnityEngine.Application:Internal_ApplicationQuit ()


=================================================================
	Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at NativeMethods:destroy <0x00089>
	  at Realms.Sync.SessionHandle:Unbind <0x0003a>
	  at Realms.SharedRealmHandle:UnbindLockedList <0x0006f>
	  at Realms.SharedRealmHandle:ReleaseHandle <0x000ca>
	  at System.Runtime.InteropServices.SafeHandle:DangerousReleaseInternal <0x00208>
	  at System.Runtime.InteropServices.SafeHandle:InternalDispose <0x00032>
	  at System.Runtime.InteropServices.SafeHandle:Dispose <0x0002a>
	  at System.Runtime.InteropServices.SafeHandle:Close <0x00019>
	  at Realms.Realm:Dispose <0x00082>
	  at RealmController:OnDisable <0x0002a>
	  at System.Object:runtime_invoke_void__this__ <0x00087>
=================================================================
Received signal SIGSEGV
Obtained 37 stack frames
0x00007ffba117a994 (realm-wrappers) realm_flip_guid_for_testing
0x00007ffba119c006 (realm-wrappers) realm_flip_guid_for_testing
0x00007ffba10be929 (realm-wrappers) realm_syncsession_destroy
0x00000167ee4b419a (Mono JIT Code) (wrapper managed-to-native) Realms.Sync.SessionHandle/NativeMethods:destroy (intptr)
0x00000167ee4b3f3b (Mono JIT Code) Realms.Sync.SessionHandle:Unbind ()
0x00000167ee4b3dd0 (Mono JIT Code) Realms.SharedRealmHandle:UnbindLockedList ()
0x00000167ee4b394b (Mono JIT Code) Realms.SharedRealmHandle:ReleaseHandle ()
0x00000167f21caa99 (Mono JIT Code) System.Runtime.InteropServices.SafeHandle:DangerousReleaseInternal (bool)
0x00000167f222c9d3 (Mono JIT Code) System.Runtime.InteropServices.SafeHandle:InternalDispose ()
0x00000167f222c90b (Mono JIT Code) System.Runtime.InteropServices.SafeHandle:Dispose (bool)
0x0000016741e00c8a (Mono JIT Code) System.Runtime.InteropServices.SafeHandle:Close ()
0x00000167ee4b3173 (Mono JIT Code) Realms.Realm:Dispose ()
0x00000167ee4b30ab (Mono JIT Code) [RealmController.cs:29] RealmController:OnDisable () 
0x00000167f2139aa8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ffba4bce4b4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke 
0x00007ffba4b0e764 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke 
0x00007ffba4b0e8fc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke 
0x00007ff7cd2fdac4 (Unity) scripting_method_invoke
0x00007ff7cd2f8644 (Unity) ScriptingInvocation::Invoke
0x00007ff7cd2f872e (Unity) ScriptingInvocation::InvokeChecked
0x00007ff7cd372606 (Unity) SerializableManagedRef::CallMethod
0x00007ff7cd2cfa65 (Unity) MonoBehaviour::RemoveFromManager
0x00007ff7ccc94557 (Unity) GameObject::ActivateAwakeRecursivelyInternal
0x00007ff7ccc94169 (Unity) GameObject::ActivateAwakeRecursively
0x00007ff7ccc96d09 (Unity) GameObject::Deactivate
0x00007ff7ccfa6915 (Unity) DestroyObjectHighLevel_Internal
0x00007ff7ccfa6564 (Unity) DestroyObjectHighLevel
0x00007ff7ccfb0ebe (Unity) DestroyWorldObjects
0x00007ff7ce1e4481 (Unity) EditorSceneManager::RestoreSceneBackups
0x00007ff7cdef58cd (Unity) PlayerLoopController::ExitPlayMode
0x00007ff7cdf04a71 (Unity) PlayerLoopController::SetIsPlaying
0x00007ff7cdf07e6d (Unity) Application::TickTimer
0x00007ff7ce3537aa (Unity) MainMessageLoop
0x00007ff7ce35805b (Unity) WinMain
0x00007ff7cf6db42e (Unity) __scrt_common_main_seh
0x00007ffc57517034 (KERNEL32) BaseThreadInitThunk
0x00007ffc58842651 (ntdll) RtlUserThreadStart

@jonathan-opuscope
Copy link

Additional info for the same issue: reproduced with Unity Realm SDK Versions 10.11.1, 10.11.2 (both of which worked fine before), and 10.15.1

This occurs both in Editor and iOS build. Although the Editor crash seems like it's hardware specific (although it could be some other underlying cause)

  • MacBookPro18,3 Apple M1 Pro : no crash
  • MacBookPro15,1 6-Core Intel Core i7 : crash
  • Macmini9,1 Apple M1 : crash

This crash occurs on first call to remove (systematically) or on initial sync (circumstantially, presumably because the same logic can be called internally as part of the original realm setup depending on local/remote diff), This is what the logs look like in the Unity Editor

2022-08-10 12:13:28.170 Info: Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false
2022-08-10 12:13:28.211 Info: Connected to endpoint '34.241.208.56:443' (from '192.168.1.91:50951')
Device - Gps DataChanged 44.79374 -0.71101 0 0 from MockGpsCompass
Device - Direction Changed (59.90022, 182.5238, 0) 0
/Users/runner/work/realm-dotnet/realm-dotnet/wrappers/realm-core/src/realm/array_backlink.cpp:108: [realm-core-12.4.0] Assertion failed: int64_t(value >> 1) == key.value [267, 2]
0 librealm-wrappers.dylib 0x00000001a6fe56e1 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 369
1 librealm-wrappers.dylib 0x00000001a6e70597 ZN5realm4util9terminateIJxxEEEvPKcS3_lDpT + 55
2 librealm-wrappers.dylib 0x00000001a6e7050b _ZN5realm13ArrayBacklink6removeEmNS_6ObjKeyE + 683
3 librealm-wrappers.dylib 0x00000001a6f17d80 _ZN5realm3Obj19remove_one_backlinkENS_6ColKeyENS_6ObjKeyE + 464
4 librealm-wrappers.dylib 0x00000001a6f1953b _ZNK5realm3Obj15remove_backlinkENS_6ColKeyENS_7ObjLinkERNS_12CascadeStateE + 395
5 librealm-wrappers.dylib 0x00000001a6eb6b2d _ZNK5realm10Dictionary16remove_backlinksERNS_12CascadeStateE + 253
6 librealm-wrappers.dylib 0x00000001a6e91e5d _ZZN5realm4util11FunctionRefIFbNS_6ColKeyEEEC1IRZNS_7Cluster5eraseENS_6ObjKeyERNS_12CascadeStateEE3$3EEOT_ENUlPvS2_E_8__invokeESE_S2 + 1613
7 librealm-wrappers.dylib 0x00000001a6fb1477 _ZNK5realm16TableClusterTree25for_each_and_every_columnENS_4util11FunctionRefIFbNS_6ColKeyEEEE + 87
8 librealm-wrappers.dylib 0x00000001a6e8a91c _ZN5realm7Cluster5eraseENS_6ObjKeyERNS_12CascadeStateE + 204
9 librealm-wrappers.dylib 0x00000001a6e9d990 _ZZN5realm16ClusterNodeInner5eraseENS_6ObjKeyERNS_12CascadeStateEENK3$_3clEPNS_11ClusterNodeERNS0_9ChildInfoE + 48
10 librealm-wrappers.dylib 0x00000001a6e99375 _ZN5realm16ClusterNodeInner5eraseENS_6ObjKeyERNS_12CascadeStateE + 517
11 librealm-wrappers.dylib 0x00000001a6e9c321 _ZN5realm11ClusterTree5eraseENS_6ObjKeyERNS_12CascadeStateE + 97
12 librealm-wrappers.dylib 0x00000001a6f8f42b _ZN5realm5Table16remove_recursiveERNS_12CascadeStateE + 1659
13 librealm-wrappers.dylib 0x00000001a6fa4555 _ZN5realm5Table13remove_objectENS_6ObjKeyE + 245
14 librealm-wrappers.dylib 0x00000001a6fa48b2 _ZN5realm5Table17invalidate_objectENS_6ObjKeyE + 642
15 librealm-wrappers.dylib 0x00000001a6dca0ef _ZN5realm4sync18InstructionApplierclERKNS0_5instr11EraseObjectE + 95
16 librealm-wrappers.dylib 0x00000001a6de8ab3 _ZN5realm4sync13ClientHistory27integrate_server_changesetsERKNS0_12SyncProgressEPKyPKNS0_11Transformer15RemoteChangesetEmRNS0_11VersionInfoENS0_18DownloadBatchStateERNS_4util6LoggerENSE_14UniqueFunctionIFvRKNSt3__110shared_ptrINS_11TransactionEEEEEEPNS1_20SyncTransactReporterE + 1955
17 librealm-wrappers.dylib 0x00000001a6df98f5 _ZN5realm4sync10ClientImpl7Session20integrate_changesetsERNS0_17ClientReplicationERKNS0_12SyncProgressEyRKNSt3__16vectorINS0_11Transformer15RemoteChangesetENS8_9allocatorISB_EEEERNS0_11VersionInfoENS0_18DownloadBatchStateE + 149
18 librealm-wrappers.dylib 0x00000001a6dbff62 _ZN5realm4sync10ClientImpl7Session29initiate_integrate_changesetsEyNS0_18DownloadBatchStateERKNSt3__16vectorINS0_11Transformer15RemoteChangesetENS4_9allocatorIS7_EEEE + 114
19 librealm-wrappers.dylib 0x00000001a6df6679 _ZN5realm5_impl14ClientProtocol22parse_message_receivedINS_4sync10ClientImpl10ConnectionEEEvRT_NSt3__117basic_string_viewIcNS8_11char_traitsIcEEEE + 11321
20 librealm-wrappers.dylib 0x00000001a6df0e24 _ZN5realm4sync10ClientImpl10Connection33websocket_binary_message_receivedEPKcm + 52
21 librealm-wrappers.dylib 0x00000001a6e54506 _ZN12_GLOBAL__N_19WebSocket17frame_reader_loopEv + 1430
22 librealm-wrappers.dylib 0x00000001a6e4834d ZN5realm4util7network7Service9AsyncOper22do_recycle_and_executeINS0_14UniqueFunctionIFvNSt3__110error_codeEmEEEJRS7_RmEEEvbRT_DpOT0 + 157
23 librealm-wrappers.dylib 0x00000001a6e47d5c _ZN5realm4util7network7Service14BasicStreamOpsINS1_3ssl6StreamEE16BufferedReadOperINS0_14UniqueFunctionIFvNSt3__110error_codeEmEEEE19recycle_and_executeEv + 140
24 librealm-wrappers.dylib 0x00000001a6e4a195 _ZN5realm4util7network7Service4Impl3runEv + 645
25 librealm-wrappers.dylib 0x00000001a6cd8d80 ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm5_impl10SyncClientC1ENS2_INS7_4util6LoggerENS4_ISB_EEEERKNS7_16SyncClientConfigENS_8weak_ptrIKNS7_11SyncManagerEEEEUlvE0_EEEEEPvSN + 176
26 libsystem_pthread.dylib 0x00007ff80707d514 _pthread_start + 125
27 libsystem_pthread.dylib 0x00007ff80707902f thread_start + 15!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/chooseObtained 32 stack frames.
#0 0x007ff807047112 in __pthread_kill
#1 0x007ff806fc9d10 in abort
#2 0x000001a6fe5569 in please_report_this_issue_in_github_realm_realm_core
#3 0x000001a6fe59cb in realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits, std::__1::allocator >&)
#4 0x000001a6fe56e1 in realm::util::terminate(char const*, char const*, long, std::initializer_listrealm::util::Printable&&)
#5 0x000001a6e70597 in void realm::util::terminate<long long, long long>(char const*, char const*, long, long long, long long)
#6 0x000001a6e7050b in realm::ArrayBacklink::remove(unsigned long, realm::ObjKey)
#7 0x000001a6f17d80 in realm::Obj::remove_one_backlink(realm::ColKey, realm::ObjKey)
#8 0x000001a6f1953b in realm::Obj::remove_backlink(realm::ColKey, realm::ObjLink, realm::CascadeState&) const
#9 0x000001a6eb6b2d in realm::Dictionary::remove_backlinks(realm::CascadeState&) const
#10 0x000001a6e91e5d in realm::util::FunctionRef<bool (realm::ColKey)>::FunctionRef<realm::Cluster::erase(realm::ObjKey, realm::CascadeState&)::$_3&>(realm::Cluster::erase(realm::ObjKey, realm::CascadeState&)::$_3&)::'lambda'(void*, realm::ColKey)::__invoke(void*, realm::ColKey)
#11 0x000001a6fb1477 in realm::TableClusterTree::for_each_and_every_column(realm::util::FunctionRef<bool (realm::ColKey)>) const
#12 0x000001a6e8a91c in realm::Cluster::erase(realm::ObjKey, realm::CascadeState&)
#13 0x000001a6e9d990 in realm::ClusterNodeInner::erase(realm::ObjKey, realm::CascadeState&)::$_3::operator()(realm::ClusterNode*, realm::ClusterNodeInner::ChildInfo&) const
#14 0x000001a6e99375 in realm::ClusterNodeInner::erase(realm::ObjKey, realm::CascadeState&)
#15 0x000001a6e9c321 in realm::ClusterTree::erase(realm::ObjKey, realm::CascadeState&)
#16 0x000001a6f8f42b in realm::Table::remove_recursive(realm::CascadeState&)
#17 0x000001a6fa4555 in realm::Table::remove_object(realm::ObjKey)
#18 0x000001a6fa48b2 in realm::Table::invalidate_object(realm::ObjKey)
#19 0x000001a6dca0ef in realm::sync::InstructionApplier::operator()(realm::sync::instr::EraseObject const&)
#20 0x000001a6de8ab3 in realm::sync::ClientHistory::integrate_server_changesets(realm::sync::SyncProgress const&, unsigned long long const*, realm::sync::Transformer::RemoteChangeset const*, unsigned long, realm::sync::VersionInfo&, realm::sync::DownloadBatchState, realm::util::Logger&, realm::util::UniqueFunction<void (std::__1::shared_ptrrealm::Transaction const&)>, realm::sync::ClientHistory::SyncTransactReporter*)
#21 0x000001a6df98f5 in realm::sync::ClientImpl::Session::integrate_changesets(realm::sync::ClientReplication&, realm::sync::SyncProgress const&, unsigned long long, std::__1::vector<realm::sync::Transformer::RemoteChangeset, std::__1::allocatorrealm::sync::Transformer::RemoteChangeset > const&, realm::sync::VersionInfo&, realm::sync::DownloadBatchState)
#22 0x000001a6dbff62 in realm::sync::ClientImpl::Session::initiate_integrate_changesets(unsigned long long, realm::sync::DownloadBatchState, std::__1::vector<realm::sync::Transformer::RemoteChangeset, std::__1::allocatorrealm::sync::Transformer::RemoteChangeset > const&)
#23 0x000001a6df6679 in void realm::_impl::ClientProtocol::parse_message_receivedrealm::sync::ClientImpl::Connection(realm::sync::ClientImpl::Connection&, std::__1::basic_string_view<char, std::__1::char_traits >)
#24 0x000001a6df0e24 in realm::sync::ClientImpl::Connection::websocket_binary_message_received(char const*, unsigned long)
#25 0x000001a6e54506 in (anonymous namespace)::WebSocket::frame_reader_loop()
#26 0x000001a6e4834d in void realm::util::network::Service::AsyncOper::do_recycle_and_execute<realm::util::UniqueFunction<void (std::__1::error_code, unsigned long)>, std::__1::error_code&, unsigned long&>(bool, realm::util::UniqueFunction<void (std::__1::error_code, unsigned long)>&, std::__1::error_code&, unsigned long&)
#27 0x000001a6e47d5c in realm::util::network::Service::BasicStreamOpsrealm::util::network::ssl::Stream::BufferedReadOper<realm::util::UniqueFunction<void (std::__1::error_code, unsigned long)> >::recycle_and_execute()
#28 0x000001a6e4a195 in realm::util::network::Service::Impl::run()
#29 0x000001a6cd8d80 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, realm::_impl::SyncClient::SyncClient(std::__1::unique_ptr<realm::util::Logger, std::__1::default_deleterealm::util::Logger >, realm::SyncClientConfig const&, std::__1::weak_ptr<realm::SyncManager const>)::'lambda0'()> >(void*)
#30 0x007ff80707d514 in _pthread_start
#31 0x007ff80707902f in thread_start
Launching bug reporter
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QObject(0x60000003d380), parent's thread is QThread(0x600001708290), current thread is Thread(0x600001b5d290)

@jonathan-opuscope
Copy link

To emphasise, this is code which has worked for many month and we have identical versions (Unity, xcode, realm, ios) and this issue has surfaced. Unless I'm missing something, it seems to point to an issue introduced by changes in the realm backend.

@nirinchev
Copy link
Member

@ironage this looks like a crash when removing backlink - can you take a look and see if anything jumps at you? Also, can you advise what information we need to investigate/repro this?

@ironage
Copy link

ironage commented Aug 10, 2022

This could very well be fixed by realm/realm-core#5574 which was released in core v12.2.0 (the original stack trace above uses realm-core-12.1.0). Is there a Mixed property that sets a TypedLink (aka ObjLink) value involved here?

@nirinchev
Copy link
Member

The last few comments/stacktraces are using Core 12.4.0 though, so while the original issue may have been fixed in 12.2.0, there must be something else still lurking.

@jonathan-opuscope
Copy link

jonathan-opuscope commented Aug 11, 2022

We've drilled down and identified the cause (reproducible with latest realm SDK). We have an embedded object like this:

	public class UserCompositionInteraction : EmbeddedObject
	{
		[MapTo("like")]
		[Realms.Preserve]
		public bool Like { get; set; }
		
		[MapTo("views")]
		[Realms.Preserve]
		public int Views { get; set; }
	}

Used in a dictionary

	public class Composition : RealmObject
	{
                [MapTo("userInteractions")]
                [Realms.Preserve]
                public IDictionary<string, UserCompositionInteraction> UserInteractions { get; }
         }

And a server side schema like this

    "userInteractions": {
      "bsonType": "object",
      "additionalProperties": {
        "bsonType": "object",
        "title": "UserCompositionInteraction",
        "properties": {
          "like": {
            "bsonType": "bool"
          },
          "views": {
            "bsonType": "int"
          }
        },
        "required": [
          "like",
          "views"
        ]
      }
    }

Whether the embedded objects is nested in the collection objects or not in the client side, this schema causes Unity editor to crash (reproducible on device). Reproducibility is high, especially when objects are created during application lifetime.

@nirinchev
Copy link
Member

I can't seem to easily reproduce this. @jonathan-opuscope if you can repro that in a small isolated project, that would be immensely helpful. Otherwise, can I ask you to open a support ticket at https://support.mongodb.com and work with the support engineer to collect the information they need to hand that over to the server team for investigation.

@jonathan-opuscope
Copy link

I've sent a small Unity project to repro at help@realm.io, let me know if I can provide further info

@nirinchev
Copy link
Member

Hey @jonathan-opuscope, thank you for the repro project. Unfortunately, everything seems to be working fine when I run it against my app. My hunch is that something in the sync history is corrupted for your app and we'll need the server team to investigate and understand what. Another theory is that the data you have inserted has an effect - I inserted several dummy compositions with fairly random properties. It's possible that you have inserted something that breaks Core in a non-obvious way.

FWIW, I did get a seemingly unrelated crash of the editor, which I filed a ticket for here: realm/realm-core#5752.

@jonathan-opuscope
Copy link

Ok, thanks a lot. Will let you know if we can provide more info.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Sep 12, 2022
@papafe papafe added the More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. label Nov 29, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2023

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.

@github-actions github-actions bot closed this as completed Jan 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

7 participants