yandexmobile / metrica-sdk-ios

AppMetrica is a free real-time ad tracking and mobile app analytics solution.
https://tech.yandex.com/metrica-mobile-sdk/
Other
73 stars 15 forks source link

Crashed: ru.yandex.mobile.YandexMobileMetrica.YMMCancelableDelayedExecutor.Queue #98

Open Semty opened 2 years ago

Semty commented 2 years ago

The issue popped up only on spm (I've been using appmetrica via cocoapods and everything was fine). Stack trace:

Crashed: ru.yandex.mobile.YandexMobileMetrica.YMMCancelableDelayedExecutor.Queue
0  libobjc.A.dylib                0x3490 objc_retain + 16
1  YandexMobileMetrica            0x70938 _hidden#6546_ + 21548
2  YandexMobileMetrica            0xbfce4 _hidden#10344_ + 266920
3  YandexMobileMetrica            0xbff88 _hidden#10348_ + 267596
4  YandexMobileMetrica            0xbff28 _hidden#10347_ + 267500
5  YandexMobileMetrica            0x9d64c _hidden#8694_ + 125968
6  libdispatch.dylib              0x1c04 _dispatch_call_block_and_release + 32
7  libdispatch.dylib              0x3950 _dispatch_client_callout + 20
8  libdispatch.dylib              0xb0ac _dispatch_lane_serial_drain + 664
9  libdispatch.dylib              0xbc10 _dispatch_lane_invoke + 392
10 libdispatch.dylib              0x16318 _dispatch_workloop_worker_thread + 656
11 libsystem_pthread.dylib        0x11b0 _pthread_wqthread + 288
12 libsystem_pthread.dylib        0xf50 start_wqthread + 8

iPhone 11, iOS 15.0.2 YandexMobileMetrica: 4.0.0

GLinnik21 commented 2 years ago

Could you please provide a full crash log (with base addresses of binary images)

Semty commented 2 years ago

@GLinnik21 hey. That's the crash log I just got from Crashlytics, there is not much to add to it. But I have one more from iOS crash system (but I'm not sure that it's the same one though), here it is: Pasted Graphic copy It crashes on the line with this code: YMMYandexMetrica.activate(with: configuration) iOS 15.0.2 iPhone 7 YandexMobileMetrica 4.0.0

GLinnik21 commented 2 years ago

OK. Even though could you send a full crash log from Xcode in text format?

Semty commented 2 years ago

@GLinnik21

Incident Identifier: E4176A5D-69CC-4F08-AEA9-11A7F0EB2028
Hardware Model:      iPhone9,3
Process:             XX [4414]
Path:                /private/var/containers/Bundle/Application/FBF2FE01-CF0E-4ED6-BE9A-1E522C22226C/XX.app/XX
Identifier:          XX.XX.XX
Version:             X.X.X (X)
AppStoreTools:       XXX
AppVariant:          1:iPhone9,3:13
Code Type:           ARM-64 (Native)
Role:                Non UI
Parent Process:      launchd [1]
Coalition:           XX.XX.XX [902]

Date/Time:           2021-10-29 15:39:36.5683 +0300
Launch Time:         2021-10-29 15:39:25.7487 +0300
OS Version:          iPhone OS 15.0.2 (19A404)
Release Type:        User
Baseband Version:    6.00.00
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Kernel Triage:
VM - Fault hit memory shortage
VM - Fault hit memory shortage

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001be5be280 __open + 8
1   libsystem_kernel.dylib          0x00000001be5be618 open + 36 (open-base.c:101)
2   CoreFoundation                  0x0000000185055ac0 _CFReadBytesFromFile + 176 (CFFileUtilities.c:96)
3   CoreFoundation                  0x0000000185020458 CFURLCreateDataAndPropertiesFromResource + 312 (CFURLAccess.c:277)
4   CoreFoundation                  0x000000018502d268 _CFBundleCopyInfoDictionaryInDirectoryWithVersion + 812 (CFBundle_InfoPlist.c:861)
5   CoreFoundation                  0x00000001850053a8 _CFBundleRefreshInfoDictionaryAlreadyLocked + 140 (CFBundle_InfoPlist.c:1106)
6   CoreFoundation                  0x00000001850202fc CFBundleGetInfoDictionary + 48 (CFBundle_InfoPlist.c:1120)
7   CoreFoundation                  0x0000000185032ddc _CFBundleCreate + 468 (CFBundle.c:903)
8   Foundation                      0x000000018676483c -[NSBundle _cfBundle] + 64 (NSBundle.m:181)
9   Foundation                      0x000000018678e4c8 -[NSBundle bundleURL] + 44 (NSBundle.m:932)
10  YandexMobileMetrica             0x000000010464cdb0 0x104620000 + 183728
11  YandexMobileMetrica             0x00000001046a79fc 0x104620000 + 555516
12  YandexMobileMetrica             0x000000010468400c 0x104620000 + 409612
13  YandexMobileMetrica             0x0000000104683f84 0x104620000 + 409476
14  libdispatch.dylib               0x0000000184d3a2f0 _dispatch_client_callout + 16 (object.m:560)
15  libdispatch.dylib               0x0000000184cdb8dc _dispatch_once_callout + 28 (once.c:52)
16  YandexMobileMetrica             0x0000000104683f58 0x104620000 + 409432
17  YandexMobileMetrica             0x0000000104662e10 0x104620000 + 273936
18  YandexMobileMetrica             0x0000000104627b10 0x104620000 + 31504
19  YandexMobileMetrica             0x000000010467b794 0x104620000 + 374676
20  YandexMobileMetrica             0x00000001046c52f0 0x104620000 + 676592
21  libdispatch.dylib               0x0000000184d3a2f0 _dispatch_client_callout + 16 (object.m:560)
22  libdispatch.dylib               0x0000000184cdb8dc _dispatch_once_callout + 28 (once.c:52)
23  YandexMobileMetrica             0x00000001046c5280 0x104620000 + 676480
24  YandexMobileMetrica             0x00000001046c6820 0x104620000 + 682016
25  YandexMobileMetrica             0x00000001046c6a74 0x104620000 + 682612
26  XX                              0x0000000103194ac0 specialized YandexMetric.activate() + 144 (YandexMetric.swift:22)
27  XX                              0x000000010303045c activate + 4 (<compiler-generated>:0)
28  XX                              0x000000010303045c MetricsManager.activate() + 348 (MetricsManager.swift:219)
29  XX                              0x0000000102f55564 startMetrics + 28 (AppCoordinator.swift:169)
30  XX                              0x0000000102f55564 AppCoordinator.start() + 216 (AppCoordinator.swift:180)
31  XX                              0x00000001030a88f0 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 328 (AppDelegate.swift:24)
32  XX                              0x00000001030a89c0 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 136 (<compiler-generated>:0)
33  UIKitCore                       0x000000018764f34c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 352 (UIApplication.m:2292)
34  UIKitCore                       0x0000000187826624 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3456 (UIApplication.m:2704)
35  UIKitCore                       0x000000018780f80c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1216 (UIApplication.m:4437)
36  UIKitCore                       0x000000018767b9ec -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 148 (_UISceneLifecycleMultiplexer.m:452)
37  UIKitCore                       0x00000001874deb00 _UIScenePerformActionsWithLifecycleActionMask + 96 (_UISceneLifecycleState.m:109)
38  UIKitCore                       0x00000001876039f4 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 196 (_UISceneLifecycleMultiplexer.m:565)
39  UIKitCore                       0x000000018771a284 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 368 (_UISceneLifecycleMultiplexer.m:517)
40  UIKitCore                       0x0000000187947064 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 732 (_UISceneLifecycleMultiplexer.m:564)
41  UIKitCore                       0x00000001878d6dac -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 336 (_UISceneLifecycleMultiplexer.m:470)
42  UIKitCore                       0x00000001874df9e8 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 188 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:73)
43  UIKitCore                       0x000000018759c2f8 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 812 (BSAnimationSettings+UIKit.m:50)
44  UIKitCore                       0x00000001874e1778 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 248 (_UISceneSettingsDiffAction.m:23)
45  UIKitCore                       0x00000001875c7530 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 356 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:58)
46  UIKitCore                       0x0000000187a23bec __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.573 + 772 (UIScene.m:1775)
47  UIKitCore                       0x000000018750ff80 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248 (UIScene.m:1476)
48  UIKitCore                       0x00000001875523ec -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 264 (UIScene.m:1742)
49  UIKitCore                       0x0000000187680684 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 548 (UIApplication.m:3900)
50  UIKitCore                       0x00000001875c594c -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360 (UIApplicationSceneClientAgent.m:45)
51  FrontBoardServices              0x0000000195a62fc4 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 412 (FBSScene.m:439)
52  FrontBoardServices              0x0000000195a85550 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 + 100 (FBSWorkspaceScenesClient.m:384)
53  FrontBoardServices              0x0000000195a45714 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 (FBSWorkspace.m:352)
54  FrontBoardServices              0x0000000195a46b1c __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 312 (FBSWorkspaceScenesClient.m:383)
55  libdispatch.dylib               0x0000000184d3a2f0 _dispatch_client_callout + 16 (object.m:560)
56  libdispatch.dylib               0x0000000184cdcf38 _dispatch_block_invoke_direct$VARIANT$mp + 220 (queue.c:489)
57  FrontBoardServices              0x0000000195a46d7c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40 (FBSSerialQueue.m:157)
58  FrontBoardServices              0x0000000195a46300 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176 (FBSSerialQueue.m:181)
59  FrontBoardServices              0x0000000195a4a3f0 -[FBSSerialQueue _performNextFromRunLoopSource] + 24 (FBSSerialQueue.m:194)
60  CoreFoundation                  0x000000018508e220 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1972)
61  CoreFoundation                  0x000000018509e248 __CFRunLoopDoSource0 + 204 (CFRunLoop.c:2016)
62  CoreFoundation                  0x0000000184fe15e8 __CFRunLoopDoSources0 + 256 (CFRunLoop.c:2053)
63  CoreFoundation                  0x0000000184fe6a18 __CFRunLoopRun + 768 (CFRunLoop.c:2951)
64  CoreFoundation                  0x0000000184ff9d8c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
65  GraphicsServices                0x000000019f1069a0 GSEventRunModal + 160 (GSEvent.c:2200)
66  UIKitCore                       0x000000018782efa8 -[UIApplication _run] + 1080 (UIApplication.m:3457)
67  UIKitCore                       0x00000001875c322c UIApplicationMain + 2060 (UIApplication.m:5013)
68  XX                              0x0000000102d8a7cc main + 68 (CGImage+Accelerate.swift:10)
69  dyld                            0x0000000104128190 start + 444 (dyldMain.cpp:876)
iDevPro commented 2 years ago

Please check this function with ASAN :) I have


==42323==ERROR: AddressSanitizer: heap-use-after-free on address 0x0001150d1dd1 at pc 0x00010937ba74 bp 0x00016d591c50 sp 0x00016d591408
READ of size 1 at 0x0001150d1dd1 thread T7
    #0 0x10937ba70 in wrap_strlen+0x150 (libclang_rt.asan_iossim_dynamic.dylib:arm64+0x13a70)
    #1 0x180825cc4 in +[NSString stringWithUTF8String:]+0x24 (Foundation:arm64+0x13bcc4)
    #2 0x104a602ac in +[YMMSymbolsExtractor stringForCString:]+0x1c (RBCReader:arm64+0x101e242ac)
    #3 0x104a601e8 in +[YMMSymbolsExtractor binaryImageForImage:]+0xac (RBCReader:arm64+0x101e241e8)
    #4 0x104a600ac in +[YMMSymbolsExtractor imageForImageIndex:]+0x50 (RBCReader:arm64+0x101e240ac)
    #5 0x104a5ffec in +[YMMSymbolsExtractor images]+0x70 (RBCReader:arm64+0x101e23fec)
    #6 0x104a5fa58 in __35+[YMMSymbolsExtractor sharedImages]_block_invoke+0x14 (RBCReader:arm64+0x101e23a58)
iDevPro commented 1 year ago

I found one yet crash when run simulator while play Yandex Music on background in Safari :)

Incident Identifier: 26FF1E96-E343-4382-B05B-53C537392BCC
CrashReporter Key:   CCCB1C28-464A-A913-D027-DD068F2DEF92
Hardware Model:      MacBookPro18,3
Process:             RBCReader [41882]
Path:                /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/421D5638-4EDE-4C5D-8220-D40C5551FC60/data/Containers/Bundle/Application/3CC6AA87-67E7-4B72-A8E5-68C235265238/AppName.app/AppName
Identifier:          ru.my.appname
Version:             0.0.0
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [22504]
Coalition:           com.apple.CoreSimulator.SimDevice.421D5638-4EDE-4C5D-8220-D40C5551FC60 [8440]
Responsible Process: SimulatorTrampoline [851]

Date/Time:           2023-01-31 17:28:03.5648 +0300
Launch Time:         2023-01-31 17:28:01.9452 +0300
OS Version:          macOS 13.2 (22D49)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  7

Last Exception Backtrace:
0   CoreFoundation                         0x1803f3d5c __exceptionPreprocess + 216
1   libobjc.A.dylib                        0x18019814c objc_exception_throw + 56
2   Foundation                             0x1807641d0 -[NSFileManager contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:] + 1052
3   AppName                                0x10400eaf4 +[YMMFileUtility sortedByDateContentOfDirectory:error:] + 224
4   AppName                                0x10400e8cc +[YMMFileUtility pathsForFilesWithExtension:] + 96
5   AppName                                0x1040f4c18 +[YMMSymbolsManager enumerateCacheFilesWithBlock:] + 96
6   AppName                                0x1040f4578 +[YMMSymbolsManager registeredApiKeys] + 160
7   AppName                                0x1040f9900 __48-[YMMCrashReporter addRegisteredCrashProcessors]_block_invoke + 72
8   AppName                                0x104044154 __28-[YMMAsyncExecutor execute:]_block_invoke + 36
9   libdispatch.dylib                      0x18010d244 _dispatch_call_block_and_release + 24
10  libdispatch.dylib                      0x18010ea98 _dispatch_client_callout + 16
11  libdispatch.dylib                      0x180115acc _dispatch_lane_serial_drain + 652
12  libdispatch.dylib                      0x180116648 _dispatch_lane_invoke + 400
13  libdispatch.dylib                      0x180120e10 _dispatch_workloop_worker_thread + 736
14  libsystem_pthread.dylib                0x1cc0af8fc _pthread_wqthread + 284
15  libsystem_pthread.dylib                0x1cc0ae6c0 start_wqthread + 8
OneSman7 commented 1 year ago

I found one yet crash when run simulator while play Yandex Music on background in Safari :)

Incident Identifier: 26FF1E96-E343-4382-B05B-53C537392BCC
CrashReporter Key:   CCCB1C28-464A-A913-D027-DD068F2DEF92
Hardware Model:      MacBookPro18,3
Process:             RBCReader [41882]
Path:                /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/421D5638-4EDE-4C5D-8220-D40C5551FC60/data/Containers/Bundle/Application/3CC6AA87-67E7-4B72-A8E5-68C235265238/AppName.app/AppName
Identifier:          ru.my.appname
Version:             0.0.0
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [22504]
Coalition:           com.apple.CoreSimulator.SimDevice.421D5638-4EDE-4C5D-8220-D40C5551FC60 [8440]
Responsible Process: SimulatorTrampoline [851]

Date/Time:           2023-01-31 17:28:03.5648 +0300
Launch Time:         2023-01-31 17:28:01.9452 +0300
OS Version:          macOS 13.2 (22D49)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  7

Last Exception Backtrace:
0   CoreFoundation                           0x1803f3d5c __exceptionPreprocess + 216
1   libobjc.A.dylib                          0x18019814c objc_exception_throw + 56
2   Foundation                               0x1807641d0 -[NSFileManager contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:] + 1052
3   AppName                              0x10400eaf4 +[YMMFileUtility sortedByDateContentOfDirectory:error:] + 224
4   AppName                              0x10400e8cc +[YMMFileUtility pathsForFilesWithExtension:] + 96
5   AppName                              0x1040f4c18 +[YMMSymbolsManager enumerateCacheFilesWithBlock:] + 96
6   AppName                              0x1040f4578 +[YMMSymbolsManager registeredApiKeys] + 160
7   AppName                              0x1040f9900 __48-[YMMCrashReporter addRegisteredCrashProcessors]_block_invoke + 72
8   AppName                              0x104044154 __28-[YMMAsyncExecutor execute:]_block_invoke + 36
9   libdispatch.dylib                        0x18010d244 _dispatch_call_block_and_release + 24
10  libdispatch.dylib                        0x18010ea98 _dispatch_client_callout + 16
11  libdispatch.dylib                        0x180115acc _dispatch_lane_serial_drain + 652
12  libdispatch.dylib                        0x180116648 _dispatch_lane_invoke + 400
13  libdispatch.dylib                        0x180120e10 _dispatch_workloop_worker_thread + 736
14  libsystem_pthread.dylib                  0x1cc0af8fc _pthread_wqthread + 284
15  libsystem_pthread.dylib                  0x1cc0ae6c0 start_wqthread + 8

Вот этот креш наблюдается при использовании SwiftUI Preview в Xcode. Для их корректной работы приходится отключать инициализацию Яндекс Метрики. В обычном режиме работы креша не наблюдаю. Было круто пофиксить.