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

CTTelephonyNetworkInfo.init() is crashing the app: App Hang: The app was terminated while unresponsive #2138

Open
dcacenabes opened this issue Dec 10, 2024 · 4 comments
Labels
crash SDK crashes

Comments

@dcacenabes
Copy link

dcacenabes commented Dec 10, 2024

Stack trace

0  libobjc.A.dylib +0x6368     getMethodNoSuper_nolock(objc_class*, objc_selector*)
1  libobjc.A.dylib +0x5eec     _lookUpImpOrForward
2  libobjc.A.dylib +0x5eec     _lookUpImpOrForward
3  libobjc.A.dylib +0x40e0     __objc_msgSend_uncached
4  Foundation +0x1306c         -[NSXPCDecoder _validateAllowedClass:forKey:allowingInvocations:]
5  Foundation +0x12848         __decodeObject
6  Foundation +0x5010c         -[NSXPCDecoder _decodeObjectOfClasses:atObject:]
7  Foundation +0x4f884         __NSXPCSerializationDecodeTypedObjCValuesFromArray
8  Foundation +0x4f28c         __NSXPCSerializationDecodeInvocationArgumentArray
9  Foundation +0x4d9c4         -[NSXPCDecoder __decodeXPCObject:allowingSimpleMessageSend:outInvocation:outArguments:outArgumentsMaxCount:outMethodSignature:outSelector:isReply:replySelector:]
10 Foundation +0xb77d0         -[NSXPCDecoder _decodeReplyFromXPCObject:forSelector:]
11 Foundation +0xb5e7c         -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:]
12 Foundation +0xb8fbc         ___88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5
13 Foundation +0xb8274         -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]
14 Foundation +0x93d20         -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:]
15 Foundation +0x93adc         __NSXPCDistantObjectSimpleMessageSend2
16 CoreTelephony +0xc01dc      -[CoreTelephonyClient(Registration) getPublicSignalStrength:error:]
17 CoreTelephony +0x9a084      -[CTTelephonyNetworkInfo querySignalStrengthForDescriptor:]
18 CoreTelephony +0x99fb4      -[CTTelephonyNetworkInfo queryCTSignalStrength]
19 CoreTelephony +0x983e4      -[CTTelephonyNetworkInfo initWithClient:]
20 CoreTelephony +0x98110      -[CTTelephonyNetworkInfo init]
21 OurApp +0x1255284            @nonobjc CTTelephonyNetworkInfo.init()
22 OurApp +0x124cdbc            CTTelephonyNetworkInfo.__allocating_init()
23 OurApp +0x124cd90            default argument 0 of CarrierInfoPublisher.init(networkInfo:)
24 OurApp +0x124e098            DatadogContextProvider.__allocating_init(site:clientToken:service:env:version:buildNumber:buildId:variant:source:nativeSourceOverride:sdkVersion:ciAppOrigin:applicationName:applicationBundleIdentifier:applicationBundleType:applicationVersion:sdkInitDate:device:processInfo:dateProvider:serverDateProvider:notificationCenter:appStateProvider:)
25 OurApp +0x1247b80            DatadogCore.__allocating_init(configuration:trackingConsent:instanceName:)
26 OurApp +0x1243c1c            static Datadog.initializeOrThrow(with:trackingConsent:instanceName:)
27 OurApp +0x1243870            static Datadog.initialize(with:trackingConsent:instanceName:)
...
37 OurApp +0x20304              AppDelegate.application(_:didFinishLaunchingWithOptions:) (AppDelegate.swift:xx:yy)
38 OurApp +0x20630              @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) (<compiler-generated>)
39 UIKitCore +0x47ba9c         -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
40 UIKitCore +0x478d60         -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
41 UIKitCore +0x29a648         -[UIApplication _runWithMainScene:transitionContext:completion:]
42 UIKitCore +0x44c1a4         -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
43 UIKitCore +0x24f67c         __UIScenePerformActionsWithLifecycleActionMask
44 UIKitCore +0x3ef110         ___101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
45 UIKitCore +0x3eee20         -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
46 UIKitCore +0x1b5870         -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
47 UIKitCore +0x1b5590         -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
48 UIKitCore +0x1b5048         ___186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
49 UIKitCore +0x1b41f0         +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:]
50 UIKitCore +0x1b3828         __UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion
51 UIKitCore +0x1b34d8         -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
52 UIKitCore +0x24f42c         ___64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.229
53 UIKitCore +0x24ed7c         -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
54 UIKitCore +0x2467a0         -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
55 UIKitCore +0x22ea90         -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
56 UIKitCore +0x22cf9c         -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
57 FrontBoardServices +0xc008  ___95-[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]_block_invoke
58 FrontBoardServices +0x9830  -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:]
59 FrontBoardServices +0xb790  -[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]
60 FrontBoardServices +0x1fc90 ___93-[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]_block_invoke.197
61 FrontBoardServices +0x1f4c4 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
62 FrontBoardServices +0x2eb8c -[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]
63 libdispatch.dylib +0x3fa4   __dispatch_client_callout
64 libdispatch.dylib +0x79ec   __dispatch_block_invoke_direct
65 FrontBoardServices +0x18374 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
66 FrontBoardServices +0x182f4 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible]
67 FrontBoardServices +0x181cc -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource]
68 CoreFoundation +0x73f38     ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
69 CoreFoundation +0x73ecc     ___CFRunLoopDoSource0
70 CoreFoundation +0x76b2c     ___CFRunLoopDoSources0
71 CoreFoundation +0x75d28     ___CFRunLoopRun
72 CoreFoundation +0xc8270     _CFRunLoopRunSpecific
73 GraphicsServices +0x14bc    _GSEventRunModal
74 UIKitCore +0x3ee778         -[UIApplication _run]
75 UIKitCore +0x14e60          _UIApplicationMain
76 OurApp +0x263d4              main (AppDelegate.swift:70:7)
77 dyld +0x2fde4               start

Reproduction steps

Unfortunately we do not have clear steps to reproduce. This crash is happening on app launch. We're currently using version 2.20.0 from the SDK.

Volume

0.01%

Affected SDK versions

2.17.0...2.20.0

Latest working SDK version

Unknown

Does the crash manifest in the latest SDK version?

Yes

Deployment Target

15.0, iPhone

Device Information

Nothing in common, we have multiple builds, OS versions, iPhone models, locales, etc.

Other relevant information

No response

@dcacenabes dcacenabes added the crash SDK crashes label Dec 10, 2024
@dcacenabes
Copy link
Author

We also created a support request here:
https://help.datadoghq.com/hc/en-us/requests/1955264

@maxep
Copy link
Member

maxep commented Dec 10, 2024

Hey @dcacenabes 👋

Thank you for the report!

Where does this App Hang: The app was terminated while unresponsive message comes from? Could you please share a full crash report with the exception details?

The CTTelephonyNetworkInfo has been faulty in the past, with reports here and there. But this 'App Hang' message is confusing 🤔

Thank you for your help!

@dcacenabes
Copy link
Author

dcacenabes commented Dec 10, 2024

Hi @maxep !

App Hang: The app was terminated while unresponsive is added by our crash reporting tool. It is simply letting us know that the system terminated the app. It seems that the app enters a deadlock and then gets terminated by the system.

We're seeing different stack traces, but all of them have in common the call to CTTelephonyNetworkInfo.init()
e.g.

Thread 0 - com.apple.main-thread - (TH_STATE_WAITING)
0  libsystem_kernel.dylib +0x1684 _mach_msg2_trap
1  libsystem_kernel.dylib +0x4d94 _mach_msg2_internal
2  libsystem_kernel.dylib +0x4cac _mach_msg_overwrite
3  libsystem_kernel.dylib +0x4af8 _mach_msg
4  libdispatch.dylib +0x1ef10     __dispatch_mach_send_and_wait_for_reply
5  libdispatch.dylib +0x1f2b0     _dispatch_mach_send_with_result_and_wait_for_reply
6  libxpc.dylib +0x1092c          _xpc_connection_send_message_with_reply_sync
7  Foundation +0x613a8            ___NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__
8  Foundation +0x5db10            -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]
9  Foundation +0xc40c0            -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:arg3:arg4:]
10 Foundation +0xc3fd8            __NSXPCDistantObjectSimpleMessageSend4
11 CoreTelephony +0xad6c          -[CoreTelephonyClient(CarrierBundle) copyCarrierBundleValue:key:bundleType:error:]
12 CoreTelephony +0xa050          -[CTTelephonyNetworkInfo getCarrierName:forContext:withError:]
13 CoreTelephony +0x93e0          -[CTTelephonyNetworkInfo updateNetworkInfoAndShouldNotifyClient:forContext:]
14 CoreTelephony +0x8d64          -[CTTelephonyNetworkInfo initWithClient:]
15 CoreTelephony +0x1fe0          -[CTTelephonyNetworkInfo init]
16 OurApp +0x1255284               @nonobjc CTTelephonyNetworkInfo.init()
17 OurApp +0x124cdbc               CTTelephonyNetworkInfo.__allocating_init()
18 OurApp +0x124cd90               default argument 0 of CarrierInfoPublisher.init(networkInfo:)
19 OurApp +0x124e098               DatadogContextProvider.__allocating_init(site:clientToken:service:env:version:buildNumber:buildId:variant:source:nativeSourceOverride:sdkVersion:ciAppOrigin:applicationName:applicationBundleIdentifier:applicationBundleType:applicationVersion:sdkInitDate:device:processInfo:dateProvider:serverDateProvider:notificationCenter:appStateProvider:)
20 OurApp +0x1247b80               DatadogCore.__allocating_init(configuration:trackingConsent:instanceName:)
21 OurApp +0x1243c1c               static Datadog.initializeOrThrow(with:trackingConsent:instanceName:)
22 OurApp +0x1243870               static Datadog.initialize(with:trackingConsent:instanceName:)
... redacted
32 OurApp +0x20304                 AppDelegate.application(_:didFinishLaunchingWithOptions:) (AppDelegate.swift:xx:yy)
33 OurApp +0x20630                 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) (<compiler-generated>)
34 UIKitCore +0x489334            -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
35 UIKitCore +0x48684c            -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
36 UIKitCore +0x3601f4            -[UIApplication _runWithMainScene:transitionContext:completion:]
37 UIKitCore +0x314e44            -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
38 UIKitCore +0x216598            __UIScenePerformActionsWithLifecycleActionMask
39 UIKitCore +0x3d3844            ___101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
40 UIKitCore +0x3d35c0            -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
41 UIKitCore +0x17f174            -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
42 UIKitCore +0x14d808            -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
43 UIKitCore +0x14d130            ___186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
44 UIKitCore +0x14cab0            +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:]
45 UIKitCore +0x14c0e8            __UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion
46 UIKitCore +0x217b10            -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
47 UIKitCore +0x82a808            ___64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.229
48 UIKitCore +0x216018            -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
49 UIKitCore +0x2d5820            -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
50 UIKitCore +0x2d21b4            -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
51 UIKitCore +0x2d1e08            -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
52 FrontBoardServices +0x36978    ___95-[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]_block_invoke
53 FrontBoardServices +0x36d68    -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:]
54 FrontBoardServices +0x367dc    -[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]
55 FrontBoardServices +0x551f0    ___93-[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]_block_invoke.197
56 FrontBoardServices +0x14c40    -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
57 FrontBoardServices +0x5380c    -[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]
58 libdispatch.dylib +0x40cc      __dispatch_client_callout
59 libdispatch.dylib +0x7b10      __dispatch_block_invoke_direct
60 FrontBoardServices +0x162fc    __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
61 FrontBoardServices +0x1627c    -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible]
62 FrontBoardServices +0x16154    -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource]
63 CoreFoundation +0x56324        ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
64 CoreFoundation +0x562b8        ___CFRunLoopDoSource0
65 CoreFoundation +0x53e20        ___CFRunLoopDoSources0
66 CoreFoundation +0x52fb8        ___CFRunLoopRun
67 CoreFoundation +0x5282c        _CFRunLoopRunSpecific
68 GraphicsServices +0x11c0       _GSEventRunModal
69 UIKitCore +0x3d2eac            -[UIApplication _run]
70 UIKitCore +0x4815b0            _UIApplicationMain
71 OurApp +0x263d4                 main (AppDelegate.swift:70:7)
72 dyld +0x33ec4                  start

Basically the main thread gets blocked.

@dcacenabes
Copy link
Author

Here's from the docs of the tool:

App hangs that end with termination by the system watchdog or being force-quit by the user are considered to be “fatal”. By default BugSnag reports these types of app hangs when a threshold of 2000ms is exceeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash SDK crashes
Projects
None yet
Development

No branches or pull requests

2 participants