pendo-io/pendo-mobile-sdk

๐Ÿ’ฅ Crash on `DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:)` - multiple variations

Closed this issue ยท 6 comments

Platform + Version

iOS 17.4.1, iOS 17.3.1, iOS 16.6.1, iOS 16.6.0 and (many) others

SDK Version

3.1.5

Framework

Native SwiftUI

Describe the bug

Crash. As there aren't any notes on crash fixes on 3.2.0, we also suppose these will be present in the version 3.2.0.

Warning

Note that there are a couple of variants of this crash - same function, different reasons, i.e.

-[__NSCFNumber count]: unrecognized selector sent to instance 0x8000000000000000

or

-[NSIndexPath count]: unrecognized selector sent to instance 0x8000000000000000

or

-[NSTaggedPointerString count]: unrecognized selector sent to instance 0x8000000000000000

or

-[__NSTaggedDate count]: unrecognized selector sent to instance 0x8000000000000000

To Reproduce

Exact steps unknown. But it looks like the Mirror usage might not be correctly used or responds(to:) check might need to be incorporated.

Expected behavior

No crash

Logs

Not applicable. Added stack trace below.

Stack Trace

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x3c20 objc_msgSend + 32
1  libswiftCore.dylib             0xb3b08 Dictionary.startIndex.getter + 68
2  libswiftCore.dylib             0xb7e14 protocol witness for Collection.startIndex.getter in conformance [A : B] + 32
3  libswiftCore.dylib             0x25f74 Mirror.init<A, B>(_:unlabeledChildren:displayStyle:ancestorRepresentation:) + 884
4  libswiftCore.dylib             0xc2834 Dictionary.customMirror.getter + 136
5  libswiftCore.dylib             0xa75dc Mirror.init(reflecting:) + 168
6  Pendo                          0x1338cc DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11220
7  Pendo                          0x133ec8 DumpTree._scan_children(children:parent:visitedItems:depth:maxDepth:) + 12752
8  Pendo                          0x133a84 DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11660
9  Pendo                          0x133ec8 DumpTree._scan_children(children:parent:visitedItems:depth:maxDepth:) + 12752
10 Pendo                          0x133a84 DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11660
11 Pendo                          0x133ec8 DumpTree._scan_children(children:parent:visitedItems:depth:maxDepth:) + 12752
12 Pendo                          0x133a84 DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11660
13 Pendo                          0x133ec8 DumpTree._scan_children(children:parent:visitedItems:depth:maxDepth:) + 12752
14 Pendo                          0x133a84 DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11660
15 Pendo                          0x133ec8 DumpTree._scan_children(children:parent:visitedItems:depth:maxDepth:) + 12752
16 Pendo                          0x133a84 DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11660
17 Pendo                          0x133ec8 DumpTree._scan_children(children:parent:visitedItems:depth:maxDepth:) + 12752
18 Pendo                          0x133a84 DumpTree._dump(_:maxDepth:visitedItems:parent:depth:superClassScanEnable:) + 11660
19 Pendo                          0x133244 DumpTree.makeRoot(value:name:) + 9548
20 Pendo                          0x136044 specialized static DumpTree.pnd_dump(value:parentValue:name:indent:maxDepth:printingOptions:descriptionLength:pruneEnabled:) + 21324
21 Pendo                          0x133444 @objc static DumpTree.pnd_dump(value:parentValue:name:indent:maxDepth:printingOptions:descriptionLength:pruneEnabled:) + 10060
22 Pendo                          0x132768 static DumpTree.pnd_dump(topMostController:topMostControllerCoversScreen:indent:maxDepth:printingOption:descriptionLength:pruneEnabled:enableSwiftUIInsideUIKitScan:) + 6768
23 Pendo                          0x132f78 @objc static DumpTree.pnd_dump(topMostController:topMostControllerCoversScreen:indent:maxDepth:printingOption:descriptionLength:pruneEnabled:enableSwiftUIInsideUIKitScan:) + 8832
24 Pendo                          0x11b0d0 -[PNDScreenManager swiftUIDataAppend:fromWindow:rootViewController:] + 720
25 Pendo                          0x11aa24 -[PNDScreenManager screenDataFor:] + 216
26 Pendo                          0x11a744 -[PNDScreenManager screenChanged] + 56
27 Pendo                          0x11a120 __44-[PNDScreenManager triggerScreenScanOfType:]_block_invoke.48 + 508
28 Pendo                          0x10cc10 -[PNDDebouncer fireNow] + 36
29 Foundation                     0x751ce0 __NSFireTimer + 96
30 CoreFoundation                 0xad6e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
31 CoreFoundation                 0xad388 __CFRunLoopDoTimer + 1004
32 CoreFoundation                 0x37184 __CFRunLoopDoTimers + 288
33 CoreFoundation                 0x3418c __CFRunLoopRun + 1856
34 CoreFoundation                 0x33968 CFRunLoopRunSpecific + 608
35 GraphicsServices               0x34e0 GSEventRunModal + 164
36 UIKitCore                      0x22aedc -[UIApplication _run] + 888
37 UIKitCore                      0x22a518 UIApplicationMain + 340
38 REDACTED                       0x5890 main + 9 (AppDelegate.swift:9)
39 ???                            0x1b2bbad84 (Missing)

@msrutek-paylocity
Maybe you have a full Apple crash log?

@MikePendo Unfortunately, we don't ๐Ÿ˜ž This is what we were able to find.

However, in all of the crashes, it happens on the count property.

Is there something going on inside of the Pendo SDK that would be doing this dynamic check? If so, can it be updated so it utilizes the responds(to:) check?

Screenshot 2024-05-09 at 8 11 23

@msrutek-paylocity where is this count crash coming from? I can see that in the crash log you sent? can you provide a full crash log with the count crash?

we improved our scanning mechanism to scan the minimum number of objects possible, and we believe it may resolve your crashing issues.
in addition to that is will be highly recommended to change the integration with an addition flag as below:

let options = PendoOptions()
options.configs = ["enableTextCollectionSwiftUI":false]
PendoManager.shared().setup(prodAppKey,with: options)

this flag is meant to reduce the texts collection via reflection and base text collection on accessibility elements only.

this was done in our latest 3.2.1 HF fix, please try upgrading and let us know with your results.

@MikePendo @0xkuj Thanks, we've updated the library and used the suggested options configuration.

However, it might take a couple of weeks until this gets to the production users.

We'll let you know if this issue still occurs.

@msrutek-paylocity, thanks for the update.
I'm closing the issue for now, please reopen if needed.