realm-core
realm-core copied to clipboard
Cluster column has invalid length
SDK and version
SDK : Swift Version: Realm 10.28.1, RealmDatabase 12.1.0
Observations
One of the class(HLAsset) has more than 123000 items. .realm file size is 46.4MB When I open a .realm file in Realm Studio and scroll down in a class, sometime it says "Invalid time value". And sometimes, some field value looks broken characters or null (a field cannot be null)
let fetchResult = realm.objects(HLAsset.self).filter("assetCollection=%@", hlAssetCollection)
let count = fetchResult.count // => causing crash
Crash log / stack trace
/Users/xiles/Library/Developer/Xcode/DerivedData/HashPhotos-emjpzodbkpdtdgcztdgogetflflc/SourcePackages/checkouts/realm-core/src/realm/array.hpp:402: [realm-core-12.1.0] Assertion failed: start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end 0 HashPhotos 0x0000000105f04cbc _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28 1 HashPhotos 0x0000000105f04b74 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 228 2 HashPhotos 0x000000010567aa94 _ZNK5realm5Array10find_firstINS_5EqualEEEmxmm + 192 3 HashPhotos 0x000000010567a9c8 _ZNK5realm5Array10find_firstExmm + 48 4 HashPhotos 0x0000000105bfaf2c _ZNK5realm12ArrayKeyBaseILi1EE10find_firstENS_6ObjKeyEmm + 56 5 HashPhotos 0x0000000105bfae28 _ZN5realm11LinksToNodeINS_5EqualEE16find_first_localEmm + 668 6 HashPhotos 0x0000000105bf6990 _ZN5realm10ParentNode14find_all_localEmm + 80 7 HashPhotos 0x0000000105bf666c _ZN5realm10ParentNode15aggregate_localEPNS_14QueryStateBaseEmmmPNS_12ArrayPayloadE + 124 8 HashPhotos 0x0000000105b6a3d0 _ZNK5realm5Query18aggregate_internalEPNS_10ParentNodeEPNS_14QueryStateBaseEmmPNS_12ArrayPayloadE + 136 9 HashPhotos 0x0000000105b77bf4 _ZZNK5realm5Query8do_countEmENK3$_4clEPKNS_7ClusterE + 152 10 HashPhotos 0x0000000105b77b4c _ZZN5realm4util11FunctionRefIFbPKNS_7ClusterEEEC1IRZNKS_5Query8do_countEmE3$4EEOT_ENKUlPvS4_E_clESD_S4 + 56 11 HashPhotos 0x0000000105b77b04 _ZZN5realm4util11FunctionRefIFbPKNS_7ClusterEEEC1IRZNKS_5Query8do_countEmE3$4EEOT_ENUlPvS4_E_8__invokeESD_S4 + 36 12 HashPhotos 0x00000001056f3a10 ZNK5realm4util11FunctionRefIFbPKNS_7ClusterEEEclES4 + 68 13 HashPhotos 0x00000001056f3800 _ZNK5realm16ClusterNodeInner8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEEx + 352 14 HashPhotos 0x00000001056f38f0 _ZNK5realm16ClusterNodeInner8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEEx + 592 15 HashPhotos 0x00000001056f5b24 _ZNK5realm11ClusterTree8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEE + 144 16 HashPhotos 0x0000000105b6eab4 _ZNK5realm5Table17traverse_clustersENS_4util11FunctionRefIFbPKNS_7ClusterEEEE + 52 17 HashPhotos 0x0000000105b6f6c0 _ZNK5realm5Query8do_countEm + 928 18 HashPhotos 0x0000000105b6fc34 _ZN5realm5Query5countERKNS_18DescriptorOrderingE + 188 19 HashPhotos 0x0000000105983758 _ZN5realm7Results7do_sizeEv + 264 20 HashPhotos 0x000000010598d47c _ZN5realm7Results4sizeEv + 44 21 HashPhotos 0x00000001054ab684 _ZZ19-[RLMResults count]ENK3$_1clEv + 36 22 HashPhotos 0x00000001054a6f80 ZL25translateRLMResultsErrorsIZ19-[RLMResults count]E3$1EDaOT_P8NSString + 36 23 HashPhotos 0x00000001054a6f50 -[RLMResults count] + 40 24 HashPhotos 0x000000010556f51c $s10RealmSwift0A14CollectionImplPAAE5countSivg + 172 25 HashPhotos 0x000000010488579c $s10HashPhotos16HLAssetsProviderC11fetchAssets2in13includeHiddenyAA15AssetCollectionCSg_SbtF + 964 26 HashPhotos 0x000000010470d82c $s10HashPhotos0B14ViewControllerC15assetCollectionAA05AssetF0CSgvs + 4992 27 HashPhotos 0x0000000104d9a390 $s10HashPhotos14ViewControllerC19openAssetCollection_14collectionPathyAA0fG0CSg_SSSgtF + 3552 28 HashPhotos 0x0000000104e0f61c $s10HashPhotos14ViewControllerC04menucD0_24didSelectAssetCollection9closeMenuyAA0kcD0C_AA0hI0CSgSbtFyycfU + 88 29 HashPhotos 0x0000000104dc9a9c $s10HashPhotos14ViewControllerC13closeSideMenuyyyycSgFySbcfU0 + 912 30 HashPhotos 0x000000010465a10c $sSbIegy_SbIeyBy_TR + 64 31 UIKitCore 0x00000001852eb438 UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK + 28 32 UIKitCore 0x00000001852eb6f8 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 696 33 UIKitCore 0x00000001852beaf8 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 244 34 UIKitCore 0x00000001852bf034 -[UIViewAnimationState animationDidStop:finished:] + 240 35 QuartzCore 0x0000000188538898 _ZN2CA5Layer23run_animation_callbacksEPv + 276 36 libdispatch.dylib 0x000000010c879b94 _dispatch_client_callout + 16 37 libdispatch.dylib 0x000000010c888650 _dispatch_main_queue_drain + 1064 38 libdispatch.dylib 0x000000010c888218 _dispatch_main_queue_callback_4CF + 40 39 CoreFoundation 0x0000000180361c2c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 40 CoreFoundation 0x000000018035c0b0 __CFRunLoopRun + 2432 41 CoreFoundation 0x000000018035b218 CFRunLoopRunSpecific + 572 42 GraphicsServices 0x000000018c25f60c GSEventRunModal + 160 43 UIKitCore 0x0000000184d88a98 -[UIApplication _run] + 992 44 UIKitCore 0x0000000184d8d634 UIApplicationMain + 112 45 HashPhotos 0x000000010465dd4c main + 64 46 dyld 0x000000010c729cd8 start_sim + 20 47 ??? 0x000000010c7c508c 0x0 + 4504440972 48 ??? 0xf878000000000000 0x0 + 17904060318611406848!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2022-06-27 22:41:36.973183+0900 HashPhotos[56020:7970134] /Users/xiles/Library/Developer/Xcode/DerivedData/HashPhotos-emjpzodbkpdtdgcztdgogetflflc/SourcePackages/checkouts/realm-core/src/realm/array.hpp:402: [realm-core-12.1.0] Assertion failed: start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end 0 HashPhotos 0x0000000105f04cbc _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28 1 HashPhotos 0x0000000105f04b74 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 228 2 HashPhotos 0x000000010567aa94 _ZNK5realm5Array10find_firstINS_5EqualEEEmxmm + 192 3 HashPhotos 0x000000010567a9c8 _ZNK5realm5Array10find_firstExmm + 48 4 HashPhotos 0x0000000105bfaf2c _ZNK5realm12ArrayKeyBaseILi1EE10find_firstENS_6ObjKeyEmm + 56 5 HashPhotos 0x0000000105bfae28 _ZN5realm11LinksToNodeINS_5EqualEE16find_first_localEmm + 668 6 HashPhotos 0x0000000105bf6990 _ZN5realm10ParentNode14find_all_localEmm + 80 7 HashPhotos 0x0000000105bf666c _ZN5realm10ParentNode15aggregate_localEPNS_14QueryStateBaseEmmmPNS_12ArrayPayloadE + 124 8 HashPhotos 0x0000000105b6a3d0 _ZNK5realm5Query18aggregate_internalEPNS_10ParentNodeEPNS_14QueryStateBaseEmmPNS_12ArrayPayloadE + 136 9 HashPhotos 0x0000000105b77bf4 _ZZNK5realm5Query8do_countEmENK3$_4clEPKNS_7ClusterE + 152 10 HashPhotos 0x0000000105b77b4c _ZZN5realm4util11FunctionRefIFbPKNS_7ClusterEEEC1IRZNKS_5Query8do_countEmE3$4EEOT_ENKUlPvS4_E_clESD_S4 + 56 11 HashPhotos 0x0000000105b77b04 _ZZN5realm4util11FunctionRefIFbPKNS_7ClusterEEEC1IRZNKS_5Query8do_countEmE3$4EEOT_ENUlPvS4_E_8__invokeESD_S4 + 36 12 HashPhotos 0x00000001056f3a10 ZNK5realm4util11FunctionRefIFbPKNS_7ClusterEEEclES4 + 68 13 HashPhotos 0x00000001056f3800 _ZNK5realm16ClusterNodeInner8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEEx + 352 14 HashPhotos 0x00000001056f38f0 _ZNK5realm16ClusterNodeInner8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEEx + 592 15 HashPhotos 0x00000001056f5b24 _ZNK5realm11ClusterTree8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEE + 144 16 HashPhotos 0x0000000105b6eab4 _ZNK5realm5Table17traverse_clustersENS_4util11FunctionRefIFbPKNS_7ClusterEEEE + 52 17 HashPhotos 0x0000000105b6f6c0 _ZNK5realm5Query8do_countEm + 928 18 HashPhotos 0x0000000105b6fc34 _ZN5realm5Query5countERKNS_18DescriptorOrderingE + 188 19 HashPhotos 0x0000000105983758 _ZN5realm7Results7do_sizeEv + 264 20 HashPhotos 0x000000010598d47c _ZN5realm7Results4sizeEv + 44 21 HashPhotos 0x00000001054ab684 _ZZ19-[RLMResults count]ENK3$_1clEv + 36 22 HashPhotos 0x00000001054a6f80 ZL25translateRLMResultsErrorsIZ19-[RLMResults count]E3$1EDaOT_P8NSString + 36 23 HashPhotos 0x00000001054a6f50 -[RLMResults count] + 40 24 HashPhotos 0x000000010556f51c $s10RealmSwift0A14CollectionImplPAAE5countSivg + 172 25 HashPhotos 0x000000010488579c $s10HashPhotos16HLAssetsProviderC11fetchAssets2in13includeHiddenyAA15AssetCollectionCSg_SbtF + 964 26 HashPhotos 0x000000010470d82c $s10HashPhotos0B14ViewControllerC15assetCollectionAA05AssetF0CSgvs + 4992 27 HashPhotos 0x0000000104d9a390 $s10HashPhotos14ViewControllerC19openAssetCollection_14collectionPathyAA0fG0CSg_SSSgtF + 3552 28 HashPhotos 0x0000000104e0f61c $s10HashPhotos14ViewControllerC04menucD0_24didSelectAssetCollection9closeMenuyAA0kcD0C_AA0hI0CSgSbtFyycfU + 88 29 HashPhotos 0x0000000104dc9a9c $s10HashPhotos14ViewControllerC13closeSideMenuyyyycSgFySbcfU0 + 912 30 HashPhotos 0x000000010465a10c $sSbIegy_SbIeyBy_TR + 64 31 UIKitCore 0x00000001852eb438 UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK + 28 32 UIKitCore 0x00000001852eb6f8 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 696 33 UIKitCore 0x00000001852beaf8 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 244 34 UIKitCore 0x00000001852bf034 -[UIViewAnimationState animationDidStop:finished:] + 240 35 QuartzCore 0x0000000188538898 _ZN2CA5Layer23run_animation_callbacksEPv + 276 36 libdispatch.dylib 0x000000010c879b94 _dispatch_client_callout + 16 37 libdispatch.dylib 0x000000010c888650 _dispatch_main_queue_drain + 1064 38 libdispatch.dylib 0x000000010c888218 _dispatch_main_queue_callback_4CF + 40 39 CoreFoundation 0x0000000180361c2c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 40 CoreFoundation 0x000000018035c0b0 __CFRunLoopRun + 2432 41 CoreFoundation 0x000000018035b218 CFRunLoopRunSpecific + 572 42 GraphicsServices 0x000000018c25f60c GSEventRunModal + 160 43 UIKitCore 0x0000000184d88a98 -[UIApplication _run] + 992 44 UIKitCore 0x0000000184d8d634 UIApplicationMain + 112 45 HashPhotos 0x000000010465dd4c main + 64 46 dyld 0x000000010c729cd8 start_sim + 20 47 ??? 0x000000010c7c508c 0x0 + 4504440972 48 ??? 0xf878000000000000 0x0 + 17904060318611406848!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
Hi @xiles. Thank you for reporting this. We are looking into it. It would help if you could share your realm file with us, either here, or privately at [email protected].
I sent the file via email.
Thank you. We'll take a look.
Any update on this? I got this error again from another user.
App was working well (database was OK). Added some objects. Restart an app => app crash (database file is broken)
SDK: Swift Realm 10.28.6 RealmDatabase 12.5.1
attached the database file.
In the last file, the column _mediaType
in table classHLAssert
has a length of 222 when it should be 223. This could very well cause the app to crash when a too short array is found.
Closed by #5993