有人遇到Instruments 9.3导致应用程序崩溃的问题吗?

5
当我使用xCode运行我的应用程序时,一切都加载和运行良好。当我在Instruments中加载并使用Activity Monitor或Allocations的分析模板进行记录时,它也能够加载和运行良好。然而,如果我使用Zombies或Leaks,则应用程序会立即崩溃。我甚至无法看到它。然后我在xcode中访问崩溃日志,尽管崩溃的原因是“Exception Type: EXC_BAD_ACCESS (SIGSEGV)”,但由于每个报告都不同,所以几乎不可能调试出原因。
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)  
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010  
VM Region Info: 0x10 is not in any region.  Bytes before following region: 4297687024  
      REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL  
      UNUSED SPACE AT START  
--->  
      __TEXT                 0000000100298000-0000000100388000 [  960K] r-x/r-x SM=COW  ...p/MyApp  


Termination Signal: Segmentation fault: 11  
Termination Reason: Namespace SIGNAL, Code 0xb  
Terminating Process: exc handler [0]  
Triggered by Thread:  0  


Filtered syslog:  
None found  


Thread 0 name:  Dispatch queue: com.apple.main-thread  
Thread 0 Crashed:  
0   libswiftFoundation.dylib       0x0000000100cf89fc 0x100c4c000 + 707068  
1   MyApp                   0x0000000100310cbc specialized JSONParser.jsonURL(_:jsonType:) + 494780 (JSONParser.swift:51)  
2   MyApp                   0x0000000100310cbc specialized JSONParser.jsonURL(_:jsonType:) + 494780 (JSONParser.swift:51)  
3   MyApp                   0x00000001002efd2c StoreManager.getProductIdentifiersFromServer() + 359724 (StoreManager.swift:57)  
4   MyApp                   0x0000000100329db0 specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) + 597424 (StoreManager.swift:46)  
5   MyApp                   0x0000000100326a40 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 584256 (AppDelegate.swift:0)  
6   UIKit                         0x000000018f4a1ca8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 408  
7   UIKit                         0x000000018f68fe14 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3484  
8   UIKit                         0x000000018f694ce4 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1680  
9   UIKit                         0x000000018f92db20 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 784  
10  UIKit                         0x000000018fc05c78 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160  
11  UIKit                         0x000000018f92d79c -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 240  
12  UIKit                         0x000000018f92dfdc -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 724  
13  UIKit                         0x00000001900accf4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 296  
14  UIKit                         0x00000001900acb7c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432  
15  UIKit                         0x000000018fe1f44c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220  
16  UIKit                         0x000000018ffb5c5c _performActionsWithDelayForTransitionContext + 112  
17  UIKit                         0x000000018fe1f304 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248  
18  UIKit                         0x000000018fc05318 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368  
19  UIKit                         0x000000018f6933e4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540  
20  UIKit                         0x000000018faa7490 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364  
21  FrontBoardServices             0x00000001878d7470 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364  
22  FrontBoardServices             0x00000001878dfd6c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 224  
23  libdispatch.dylib             0x00000001849f0ae4 _dispatch_client_callout + 16  
24  libdispatch.dylib             0x00000001849f81f4 _dispatch_block_invoke_direct$VARIANT$mp + 224  
25  FrontBoardServices             0x000000018790b878 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36  
26  FrontBoardServices             0x000000018790b51c -[FBSSerialQueue _performNext] + 404  
27  FrontBoardServices             0x000000018790bab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56  
28  CoreFoundation                 0x0000000185099614 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24  
29  CoreFoundation                 0x0000000185098e3c __CFRunLoopDoSources0 + 276  
30  CoreFoundation                 0x00000001850969ac __CFRunLoopRun + 1204  
31  CoreFoundation                 0x0000000184fb6fe8 CFRunLoopRunSpecific + 552  
32  GraphicsServices               0x0000000186f7e020 GSEventRunModal + 100  
33  UIKit                         0x000000018f497090 UIApplicationMain + 236  
34  MyApp                   0x00000001002ab444 main + 78916 (AppDelegate.swift:16)  
35  libdyld.dylib                 0x0000000184a55fc0 start + 4  

所以我停止打电话

StoreManager.getProductIdentifiersFromServer()  

这将停止后续对于

JSONParser.jsonURL(_:jsonType:)  

然后应用程序崩溃了。

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)  
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000  
VM Region Info: 0 is not in any region.  Bytes before following region: 4365631488  
      REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL  
      UNUSED SPACE AT START  
--->  
      __TEXT                 0000000104364000-0000000104454000 [  960K] r-x/r-x SM=COW  ...p/MyApp  


Termination Signal: Segmentation fault: 11  
Termination Reason: Namespace SIGNAL, Code 0xb  
Terminating Process: exc handler [0]  
Triggered by Thread:  0  


Filtered syslog:  
None found  


Thread 0 name:  Dispatch queue: com.apple.main-thread  
Thread 0 Crashed:  
0   CoreFoundation                 0x0000000184fdf83c CFStringGetCharacterAtIndex + 24  
1   CoreFoundation                 0x000000018508e6c8 normalizeQuintuplet + 148  
2   CoreFoundation                 0x000000018508ee64 -[_CFXPreferences+ 917092 (SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 108  
3   CoreFoundation                 0x0000000185132ae8 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 124  
4   CoreFoundation                 0x0000000185135384 _CFPreferencesCopyAppValueWithContainer + 116  
5   Foundation                     0x0000000185a2e7d0 -[NSUserDefaults+ 51152 (NSUserDefaults) objectForKey:] + 52  
6   Foundation                     0x0000000185a37240 -[NSUserDefaults+ 86592 (NSUserDefaults) stringForKey:] + 24  
7   MyApp                   0x00000001043cc0dc specialized SettingsTableViewController.init(coder:) + 426204 (SettingsTableViewController.swift:36)  
8   MyApp                   0x00000001043c6a1c @objc SettingsTableViewController.init(coder:) + 403996 (SettingsTableViewController.swift:27)  
9   UIKit                         0x000000018f9c051c -[UIClassSwapper initWithCoder:] + 248  
10  UIKit                         0x000000018fb6d99c UINibDecoderDecodeObjectForValue + 688  
11  UIKit                         0x000000018fb6d6d4 -[UINibDecoder decodeObjectForKey:] + 312  
12  UIKit                         0x000000018f9c01c4 -[UIRuntimeConnection initWithCoder:] + 188  
13  UIKit                         0x000000018fb6d99c UINibDecoderDecodeObjectForValue + 688  
14  UIKit                         0x000000018fb6db14 UINibDecoderDecodeObjectForValue + 1064  
15  UIKit                         0x000000018fb6d6d4 -[UINibDecoder decodeObjectForKey:] + 312  
16  UIKit                         0x000000018f9bf514 -[UINib instantiateWithOwner:options:] + 1164  
17  UIKit                         0x000000018fd44068 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 196  
18  MyApp                   0x00000001043fcfb4 specialized ApplicationsTabBarController.createViewControllerForTabBarController(storyBoardName:restorationIdentifier:tabBarItemTitle:tabBarItemTag:tabBarItemImage:tabBarItemSelectedImage:) + 626612 (ApplicationsTabBarController.swift:190)  
19  MyApp                   0x00000001043f93c8 ApplicationsTabBarController.setUpViewControllers() + 611272 (ApplicationsTabBarController.swift:79)  
20  MyApp                   0x00000001043fad04 @objc ApplicationsTabBarController.viewWillAppear(_:) + 617732 (ApplicationsTabBarController.swift:0)  
21  UIKit                         0x000000018f44c6b4 -[UIViewController _setViewAppearState:isAnimating:] + 616  
22  UIKit                         0x000000018f44c424 -[UIViewController __viewWillAppear:] + 140  
23  UIKit                         0x000000018f4aba60 -[UIViewController viewWillMoveToWindow:] + 704  
24  UIKit                         0x000000018f43bde4 -[UIView+ 97764 (Hierarchy) _willMoveToWindow:withAncestorView:] + 584  
25  UIKit                         0x000000018f43b0cc -[UIView+ 94412 (Internal) _addSubview:positioned:relativeTo:] + 424  
26  UIKit                         0x000000018f43a88c -[UIWindow addRootViewControllerViewIfPossible] + 816  
27  UIKit                         0x000000018f437864 -[UIWindow _setHidden:forced:] + 272  
28  UIKit                         0x000000018f4a5cd0 -[UIWindow makeKeyAndVisible] + 48  
29  MyApp                   0x00000001043f639c specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) + 598940 (AppDelegate.swift:0)  
30  MyApp                   0x00000001043f2bc4 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 584644 (AppDelegate.swift:0)  
31  UIKit                         0x000000018f4a1ca8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 408  
32  UIKit                         0x000000018f68fe14 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3484  
33  UIKit                         0x000000018f694ce4 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1680  
34  UIKit                         0x000000018f92db20 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 784  
35  UIKit                         0x000000018fc05c78 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160  
36  UIKit                         0x000000018f92d79c -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 240  
37  UIKit                         0x000000018f92dfdc -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 724  
38  UIKit                         0x00000001900accf4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 296  
39  UIKit                         0x00000001900acb7c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432  
40  UIKit                         0x000000018fe1f44c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220  
41  UIKit                         0x000000018ffb5c5c _performActionsWithDelayForTransitionContext + 112  
42  UIKit                         0x000000018fe1f304 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248  
43  UIKit                         0x000000018fc05318 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368  
44  UIKit                         0x000000018f6933e4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540  
45  UIKit                         0x000000018faa7490 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364  
46  FrontBoardServices             0x00000001878d7470 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364  
47  FrontBoardServices             0x00000001878dfd6c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 224  
48  libdispatch.dylib             0x00000001849f0ae4 _dispatch_client_callout + 16  
49  libdispatch.dylib             0x00000001849f81f4 _dispatch_block_invoke_direct$VARIANT$mp + 224  
50  FrontBoardServices             0x000000018790b878 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36  
51  FrontBoardServices             0x000000018790b51c -[FBSSerialQueue _performNext] + 404  
52  FrontBoardServices             0x000000018790bab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56  
53  CoreFoundation                 0x0000000185099614 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24  
54  CoreFoundation                 0x0000000185098e3c __CFRunLoopDoSources0 + 276  
55  CoreFoundation                 0x00000001850969ac __CFRunLoopRun + 1204  
56  CoreFoundation                 0x0000000184fb6fe8 CFRunLoopRunSpecific + 552  
57  GraphicsServices               0x0000000186f7e020 GSEventRunModal + 100  
58  UIKit                         0x000000018f497090 UIApplicationMain + 236  
59  MyApp                   0x0000000104378b3c main + 84796 (AppDelegate.swift:16)  
60  libdyld.dylib                 0x0000000184a55fc0 start + 4  

无论我调用或不调用哪些函数,都会导致崩溃。在我看来,似乎是系统调用而不是我自己的调用导致了崩溃。难道只有我发现Instruments 9.3在查找僵尸对象和内存泄漏时也会崩溃吗?


2
我也遇到了同样的问题。每次崩溃的地方都完全不同。你找到解决方法了吗?我也在9.3上。 - Josh Bernfeld
目前还没有。昨天下载了最新的Xcode,今天会再试一次并汇报结果。 - RyanTCB
最新的xCode包含了版本9.3,不幸的是。 - Josh Bernfeld
2个回答

6
我曾经遇到过类似的问题,我解决了它,选择“空白”模板而不是“泄漏”模板,然后在屏幕右上角手动添加“分配”和“泄漏”按钮。
这个问题已经在Xcode 9.4(9F1027a)版本中得到解决。

1
你救了我的一天。 - onemouth

1

苹果开发者论坛有一个有用的回复(https://forums.developer.apple.com/thread/97592):

在设置泄漏或僵尸仪器之后但在开始录制之前,转到“文件”>“录制选项...”(⌘⌥R)并取消选中“记录引用计数”。这应该允许仪器正常运行。


禁用记录引用计数会如何影响配置文件?这会禁用泄漏检测吗? - Yogurt
我已经有一段时间没有尝试过这个了,所以我不记得具体细节了。你尝试使用Xcode 10 beta中的工具了吗?(我不确定是否已经修复,但值得一试)。 - Paul King
你所建议的确实解决了我在XCode 9.4上运行instruments中的分配模块时遇到的即时崩溃问题。顺便说一下,谢谢你。但是,你发布的帖子中有一个用户说通过禁用“记录引用计数”会导致检测到更多的泄漏。我想知道的是,当我禁用这个功能时,还会出现什么其他问题?除了泄漏检测之外,显然:P僵尸对象也会受到影响吗? - Yogurt

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接