aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 885 forks source link

Kinesis crashes sometimes - iOS 18 #5448

Open elileshemautocap opened 2 weeks ago

elileshemautocap commented 2 weeks ago

app crahses on firat 3 seconds on iOS 18 (sometimes)

To Reproduce Steps to reproduce the behavior: using AWSKinesis 2.37.2 on swift app

app crashes after firehoseRecorder.submitAllRecords()

with the following trace

Crashlytics - Stack trace

Application: laika.autocap

Platform: apple

Version: 1.2.27 (226)

Issue: b8b2fba69805817e94a11d9fa93f5a73

Session: 8370a46743514cbbb45364efcbcb857e_DNE_0_v2

Date: Fri Oct 04 2024 08:47:45 GMT+0700 (Indochina Time)

Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x8408c (Missing UUID 47427277ee153c17ad686886b0380b5e) 1 libobjc.A.dylib 0x172e4 objc_exception_throw 2 CoreFoundation 0x1641c (Missing UUID 47427277ee153c17ad686886b0380b5e) 3 CoreFoundation 0x16038 (Missing UUID 47427277ee153c17ad686886b0380b5e) 4 AWSKinesis 0x54b0 __46-[AWSAbstractKinesisRecorder submitAllRecords]_block_invoke_2 + 256 (AWSAbstractKinesisRecorder.m:256) 5 AWSCore 0x23fc8 49-[AWSFMDatabaseQueue beginTransaction:withBlock:]_block_invoke + 187 (AWSFMDatabaseQueue.m:187) 6 libdispatch.dylib 0x40d0 _dispatch_client_callout 7 libdispatch.dylib 0x13750 _dispatch_lane_barrier_sync_invoke_and_complete 8 AWSCore 0x23f40 -[AWSFMDatabaseQueue beginTransaction:withBlock:] + 198 (AWSFMDatabaseQueue.m:198) 9 AWSKinesis 0x52d4 46-[AWSAbstractKinesisRecorder submitAllRecords]_block_invoke + 322 (AWSAbstractKinesisRecorder.m:322) 10 AWSCore 0x44eec 63-[AWSTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 401 (AWSTask.m:401) 11 AWSCore 0x44af4 56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke + 334 (AWSTask.m:334) 12 libdispatch.dylib 0x2370 _dispatch_call_block_and_release 13 libdispatch.dylib 0x40d0 _dispatch_client_callout 14 libdispatch.dylib 0xb6d8 _dispatch_lane_serial_drain 15 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke 16 libdispatch.dylib 0x17258 _dispatch_root_queue_drain_deferred_wlh 17 libdispatch.dylib 0x16aa4 _dispatch_workloop_worker_thread 18 libsystem_pthread.dylib 0x4c7c _pthread_wqthread 19 libsystem_pthread.dylib 0x1488 start_wqthread

com.apple.main-thread 0 CoreGraphics 0x3a148 + 264 1 CoreGraphics 0x39e3c CGBitmapContextSetData + 116 2 QuartzCore 0xeea28 + 548 3 QuartzCore 0xee47c + 496 4 QuartzCore 0xeb130 + 604 5 QuartzCore 0xeaeb4 + 120 6 QuartzCore 0x79cdc + 1660 7 UIKitCore 0x7280c + 248 8 UIKitCore 0x4b0e88 + 76 9 UIKitCore 0x4b0d18 + 168 10 UIKitCore 0x226420 + 1740 11 UIKitCore 0x1da0f0 + 72 12 UIKitCore 0x10578 + 2424 13 QuartzCore 0x78664 + 496 14 UIKitCore 0x54000 + 312 15 UIKitCore 0x237f9c + 36 16 UIKitCore 0x36429c + 216 17 UIKitCore 0x23b03c + 320 18 UIKitCore 0xb13fdc UIVIEWCONTROLLERTRANSITIONCOORDINATOR_IS_EXECUTING_ALONGSIDE_ANIMATION_BLOCK + 36 19 UIKitCore 0x2ef36c + 124 20 UIKitCore 0x2ef23c + 272 21 UIKitCore 0x1560d38 UIVIEW_IS_EXECUTING_ALONGSIDE_ANIMATION_BLOCK + 24 22 UIKitCore 0x1560ee0 + 28 23 UIKitCore 0x85ea8 + 40 24 UIKitCore 0x857bc + 40 25 UIKitCore 0x85590 + 56 26 UIKitCore 0x1561d24 + 676 27 UIKitCore 0x2728c0 + 48 28 UIKitCore 0xca3f4 + 420 29 UIKitCore 0xc9b64 + 88 30 UIKitCore 0x38e494 + 1160 31 UIKitCore 0x38cf6c + 1828 32 UIKitCore 0x2f0d64 + 1300 33 UIKitCore 0xb14980 + 160 34 UIKitCore 0x43ec80 + 96 35 UIKitCore 0xb1489c + 208 36 UIKitCore 0x1560dfc + 188 37 UIKitCore 0xb146f0 + 556 38 UIKitCore 0xa5f698 + 1756 39 UIKitCore 0xaf184 + 72 40 UIKitCore 0xaf048 + 164 41 UIKitCore 0xaef5c + 260 42 UIKitCore 0xaec7c + 80 43 UIKitCore 0xaeb8c + 72 44 UIKitCore 0xac174 + 332 45 UIKitCore 0xabfe8 + 84 46 UIKitCore 0xabc38 + 172 47 UIKitCore 0xacbac + 92 48 CoreFoundation 0x57088 + 28 49 CoreFoundation 0x5701c + 176 50 CoreFoundation 0x54b6c + 344 51 CoreFoundation 0x53d04 + 840 52 CoreFoundation 0x535b8 CFRunLoopRunSpecific + 572 53 GraphicsServices 0x11c4 GSEventRunModal + 164 54 UIKitCore 0x3de5f0 + 816 55 UIKitCore 0x48d10c UIApplicationMain + 340 56 autocap 0x206ea8 main + 19 (AppDelegate.swift:19) 57 ??? 0x1bd87bd34 (Missing)

Thread 0 libsystem_kernel.dylib 0x14b0 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x4cc8 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0x1488 start_wqthread + 8

com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x1728 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x4e38 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x4d50 mach_msg_overwrite + 424 3 libsystem_kernel.dylib 0x4b9c mach_msg + 24 4 CoreFoundation 0x547cc + 160 5 CoreFoundation 0x53e78 + 1212 6 CoreFoundation 0x535b8 CFRunLoopRunSpecific + 572 7 Foundation 0xb6f00 + 212 8 Foundation 0xb6d50 + 64 9 UIKitCore 0x3f1a44 + 420 10 Foundation 0xc8058 + 724 11 libsystem_pthread.dylib 0x637c _pthread_start + 136 12 libsystem_pthread.dylib 0x1494 thread_start + 8

Crashed: com.google.firebase.crashlytics.ios.exception 0 FirebaseCrashlytics 0x1f4c0 FIRCLSProcessRecordAllThreads + 392 (FIRCLSProcess.c:392) 1 FirebaseCrashlytics 0x1f8a4 FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423) 2 FirebaseCrashlytics 0x17c94 FIRCLSHandler + 34 (FIRCLSHandler.m:34) 3 FirebaseCrashlytics 0x12f48 FIRCLSExceptionRecord_block_invoke + 240 (FIRCLSException.mm:240) 4 libdispatch.dylib 0x40d0 _dispatch_client_callout + 20 5 libdispatch.dylib 0x13750 _dispatch_lane_barrier_sync_invoke_and_complete + 56 6 FirebaseCrashlytics 0x1203c FIRCLSExceptionRecord + 242 (FIRCLSException.mm:242) 7 FirebaseCrashlytics 0x12a58 FIRCLSExceptionRecordNSException + 126 (FIRCLSException.mm:126) 8 FirebaseCrashlytics 0x11c80 FIRCLSTerminateHandler() + 407 (FIRCLSException.mm:407) 9 libc++abi.dylib 0x1287c std::terminate(void (*)()) + 16 10 libc++abi.dylib 0x12820 std::terminate() + 108 11 libobjc.A.dylib 0x3f938 objc_terminate + 16 12 libdispatch.dylib 0x40e4 _dispatch_client_callout + 40 13 libdispatch.dylib 0x13750 _dispatch_lane_barrier_sync_invoke_and_complete + 56 14 AWSCore 0x23f40 -[AWSFMDatabaseQueue beginTransaction:withBlock:] + 198 (AWSFMDatabaseQueue.m:198) 15 AWSKinesis 0x52d4 46-[AWSAbstractKinesisRecorder submitAllRecords]_block_invoke + 322 (AWSAbstractKinesisRecorder.m:322) 16 AWSCore 0x44eec 63-[AWSTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 401 (AWSTask.m:401) 17 AWSCore 0x44af4 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke + 334 (AWSTask.m:334) 18 libdispatch.dylib 0x2370 _dispatch_call_block_and_release + 32 19 libdispatch.dylib 0x40d0 _dispatch_client_callout + 20 20 libdispatch.dylib 0xb6d8 _dispatch_lane_serial_drain + 744 21 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke + 380 22 libdispatch.dylib 0x17258 _dispatch_root_queue_drain_deferred_wlh + 288 23 libdispatch.dylib 0x16aa4 _dispatch_workloop_worker_thread + 540 24 libsystem_pthread.dylib 0x4c7c _pthread_wqthread + 288 25 libsystem_pthread.dylib 0x1488 start_wqthread + 8

Thread 0 libsystem_pthread.dylib 0x1480 start_wqthread + 9114354814

com.google.firebase.crashlytics.MachExceptionServer 0 libsystem_kernel.dylib 0x1728 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x4e38 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x4d50 mach_msg_overwrite + 424 3 libsystem_kernel.dylib 0x4b9c mach_msg + 24 4 FirebaseCrashlytics 0x1a0c8 FIRCLSMachExceptionServer + 196 (FIRCLSMachException.c:196) 5 libsystem_pthread.dylib 0x637c _pthread_start + 136 6 libsystem_pthread.dylib 0x1494 thread_start + 8

com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0x1728 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x4e38 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x4d50 mach_msg_overwrite + 424 3 libsystem_kernel.dylib 0x4b9c mach_msg + 24 4 CoreFoundation 0x547cc + 160 5 CoreFoundation 0x53e78 + 1212 6 CoreFoundation 0x535b8 CFRunLoopRunSpecific + 572 7 CFNetwork 0xfdf44 + 416 8 Foundation 0xc8058 + 724 9 libsystem_pthread.dylib 0x637c _pthread_start + 136 10 libsystem_pthread.dylib 0x1494 thread_start + 8

Thread 0 libsystem_pthread.dylib 0x1480 start_wqthread + 9114354814

AudioSession - RootQueue 0 libsystem_kernel.dylib 0x16bc semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x46e8 _dispatch_sema4_timedwait + 64 2 libdispatch.dylib 0x4ce8 _dispatch_semaphore_wait_slow + 76 3 libdispatch.dylib 0x15b60 _dispatch_worker_thread + 324 4 libsystem_pthread.dylib 0x637c _pthread_start + 136 5 libsystem_pthread.dylib 0x1494 thread_start + 8

com.apple.coremedia.sharedRootQueue.47 0 libsystem_kernel.dylib 0x16bc semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x46e8 _dispatch_sema4_timedwait + 64 2 libdispatch.dylib 0x4ce8 _dispatch_semaphore_wait_slow + 76 3 libdispatch.dylib 0x15b60 _dispatch_worker_thread + 324 4 libsystem_pthread.dylib 0x637c _pthread_start + 136 5 libsystem_pthread.dylib 0x1494 thread_start + 8

com.apple.coremedia.sharedRootQueue.47 0 libsystem_kernel.dylib 0x16bc semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x46e8 _dispatch_sema4_timedwait + 64 2 libdispatch.dylib 0x4ce8 _dispatch_semaphore_wait_slow + 76 3 libdispatch.dylib 0x15b60 _dispatch_worker_thread + 324 4 libsystem_pthread.dylib 0x637c _pthread_start + 136 5 libsystem_pthread.dylib 0x1494 thread_start + 8

mattcreaser commented 2 weeks ago

Thanks for filing this issue. The team will take a look.

elileshemautocap commented 2 weeks ago

Do you have an estimation when this issue will be fixed? It is becoming huge because more people update to iOS18 . I don't want to remove kinesis from our app

thisisabhash commented 1 week ago

Hello, Could you provide us with more information - reproduction steps, code snippets and verbose logs - to help us understand the issue? Is this only happening in iOS 18?

elileshemautocap commented 1 week ago

Hi,

I wasn't able to reproduce myself It happens on iOS 18 and above. not for every user some are new installs and for some it happens after update- i didn't find any pattern so far I attached screenshots from the xcode crashes and the firebase web site let me know if I can further assist

Do you think that it will be fixed soon? Or would it be wiser to disable Kinesis for now?

On Fri, Oct 11, 2024 at 11:43 PM Abhash Kumar Singh < @.***> wrote:

Hello, Could you provide us with more information - reproduction steps, code snippets and verbose logs - to help us understand the issue? Is this only happening in iOS 18?

— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/aws-sdk-ios/issues/5448#issuecomment-2407774887, or unsubscribe https://github.com/notifications/unsubscribe-auth/BL2F563TW6L7YHNINLTHX63Z275Z5AVCNFSM6AAAAABPLBWMCWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBXG43TIOBYG4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Eli Leshem AutoCap

elileshemautocap commented 1 week ago

Screenshot 2024-10-11 at 23 53 12 Screenshot 2024-10-11 at 23 49 45 Screenshot 2024-10-11 at 23 49 21

harsh62 commented 1 week ago

@elileshemautocap Unfortunately we are unable to reproduce the issue. Would you be able to share a small demo app in which you are able to reproduce the issue?

ruisebas commented 5 days ago

On the screenshots there's additional information in the stack trace regarding the reason of the crash: Fatal Exception: NSInvalidArgumentException *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]". This was missing from the first crashlog provided but it's indeed very helpful, as it tells us exactly what to look for.

Basically, it seems that [rs dataForColumn:@"data"] is nil and causing the exception, as you can't have nil values in an NSDictionary.

I've pushed a small fix for this to the fix/kinesis_crash branch, could you please check if using it fixes the crashes in your application and that everything else works fine?

Thanks!

elileshemautocap commented 5 days ago

Since this issue started I added a code that make sure that the dictionary had no nil values. I also added a code that calls firehoseRecorder.submitAllRecords() only at the end of the user session . The crashes are still happening for about 30-50% of iOS 18 users . I didn't find any pattern or differences in data that they are sending So i guess that the problem is that something happens with the data coming out of your database

I'm importing these libraries via a pod file

pod 'AWSMobileClient' pod 'AWSPinpoint' pod 'AWSKinesis' pod 'AWSS3' pod 'AWSSQS' pod 'AWSLambda' pod 'AWSRuntime'

can you be more specific about which parts of the branch that i need to use ? I added a crashlog awscrash.xccrashpoint.zip

ruisebas commented 3 days ago

I meant to just use the whole branch, but if you prefer to edit the files locally, it's just this small change: https://github.com/aws-amplify/aws-sdk-ios/commit/c7053f022269bb3d52df84d18a9d6cbac8ac7d57.

From the latest logs you've shared, it doesn't seem you've added this particular validation, since the same crash is happening at the same place:

Exception Reason: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]