adjust / ios_sdk

This is the iOS SDK of
http://www.adjust.com
Other
612 stars 284 forks source link

Crash +[ADJUtil isValidParameter:attributeType:parameterName:] #721

Open bkhawarABC opened 2 weeks ago

bkhawarABC commented 2 weeks ago

Stack Trace

NSInvalidArgumentException - -[NSDecimalNumber isEqualToString:]: unrecognized selector sent to instance

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x83f20 __exceptionPreprocess
1  libobjc.A.dylib                0x16018 objc_exception_throw
2  CoreFoundation                 0x18d480 +[NSObject(NSObject) _copyDescription]
3  CoreFoundation                 0x20fb4 ___forwarding___
4  CoreFoundation                 0x208d0 _CF_forwarding_prep_0
5  Adjust                         0x336ac +[ADJUtil isValidParameter:attributeType:parameterName:] + 762 (ADJUtil.m:762)
6  Adjust                         0xe6bc -[ADJActivityHandler addSessionCallbackParameterI:key:value:] + 2441 (ADJActivityHandler.m:2441)
7  Adjust                         0x33a14 __42+[ADJUtil launchInQueue:selfInject:block:]_block_invoke + 804 (ADJUtil.m:804)
8  libdispatch.dylib              0x213c _dispatch_call_block_and_release
9  libdispatch.dylib              0x3dd4 _dispatch_client_callout
10 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain
11 libdispatch.dylib              0xbf30 _dispatch_lane_invoke
12 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh
13 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread
14 libsystem_pthread.dylib        0x4934 _pthread_wqthread
15 libsystem_pthread.dylib        0x10cc start_wqthread

Additional Information

  • SDK Version: 4.38.4
  • iOS Versions Affected: iOS 15, 16, 17
  • Number of Crashes: 150+ in one week
  • Integration Method: Cocoapods
uerceg commented 2 weeks ago

Hi @bkhawarABC,

Thank you for the report. Can you maybe share with us what are the keys and values that you are attaching as session callback parameters (when invoking addSessionCallbackParameter:value: of Adjust)? Are you making sure that all of them are NSStrings before passing them to the method?

ZurabiKobakhidze commented 1 week ago

Hi,

we have similar crash. We can't replicate the crash, but in dashboard there's a few crash related to this. On the comment from @uerceg we are using String everywhere. the crash report:

+[ADJUtil writeObject:fileName:objectName:syncObject:]

          Crashed: io.adjust.PackageQueue
0  CoreFoundation                 0x18f10 __CFBasicHashRehash + 112
1  CoreFoundation                 0x85dc __CFBasicHashAddValue + 100
2  CoreFoundation                 0x1826c CFBasicHashAddValue + 420
3  CoreFoundation                 0x1805c CFDictionaryAddValue + 208
4  CoreFoundation                 0x17b30 _flattenPlist + 308
5  CoreFoundation                 0x17d00 _flattenPlist + 772
6  CoreFoundation                 0x17c9c _flattenPlist + 672
7  CoreFoundation                 0x16b7c __CFBinaryPlistWriteOrPresize + 240
8  Foundation                     0xa3de0 -[NSKeyedArchiver finishEncoding] + 640
9  Foundation                     0xa3b14 -[NSKeyedArchiver encodedData] + 116
10 Foundation                     0xa3630 +[NSKeyedArchiver archivedDataWithRootObject:requiringSecureCoding:error:] + 100
11 YOOX.COM                       0x3f9770 +[ADJUtil writeObject:fileName:objectName:syncObject:] + 334 (ADJUtil.m:334)
12 YOOX.COM                       0x3ece28 -[ADJPackageHandler writePackageQueueS:] + 395 (ADJPackageHandler.m:395)
13 YOOX.COM                       0x3ec204 -[ADJPackageHandler addI:package:] + 242 (ADJPackageHandler.m:242)
14 YOOX.COM                       0x3fb900 __42+[ADJUtil launchInQueue:selfInject:block:]_block_invoke + 804 (ADJUtil.m:804)
15 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
16 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
17 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
18 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
19 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
20 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
21 libsystem_pthread.dylib        0x4934 _pthread_wqthread + 288
22 libsystem_pthread.dylib        0x10cc start_wqthread + 8

It mainly happens on iPad, but there are some crashes on iPhone as well.

SDK version: 4.38.1 iOS versions are: 15, 16, 17 iPad versions are: 16, 17 integration: SPM

uerceg commented 1 week ago

Hi @ZurabiKobakhidze,

Those two should be not related. I believe that your crash is similar to this one. I am also noticing that you are using iOS SDK v4.38.1. Would it be possible for you to update your SDK to the latest version and let us know if you are seeing those crashes still happening?

mattiacantalu commented 1 week ago

Hi @uerceg, tbh we found occurrences the same crash even in latest SDK 4.38.4, the version we have in production right now. Any idea about that? Maybe it's better moving the discussion here https://github.com/adjust/ios_sdk/issues/639 ?

bkhawarABC commented 1 week ago

@uerceg After investigation, I found that there might be a case in which one of the parameter is an Integer rather than a String. I'll make that change on my end to enforce a NSString for those cases. Hopefully, that resolves the issue.