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

Crash report in [AWSIoTStreamThread .cxx_destruct] #5406

Closed
ad-Jun opened this issue Jul 24, 2024 · 7 comments
Closed

Crash report in [AWSIoTStreamThread .cxx_destruct] #5406

ad-Jun opened this issue Jul 24, 2024 · 7 comments
Labels
bug Something isn't working iot Issues related to the IoT SDK pending-community-response Issue is pending response from the issue requestor

Comments

@ad-Jun
Copy link

ad-Jun commented Jul 24, 2024

My SDK version is 2.36.0 and the crash appears often.

-[AWSIoTStreamThread .cxx_destruct]
EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)

          Crashed: Thread
0  libobjc.A.dylib                0x1b60 objc_release_x0 + 16
1  libobjc.A.dylib                0x1b60 objc_release + 16
2  AWSIoT                         0x85274 -[AWSIoTStreamThread .cxx_destruct] + 32 (AWSIoTStreamThread.m:32)
3  libobjc.A.dylib                0x4c3c object_cxxDestructFromClass(objc_object*, objc_class*) + 116
4  libobjc.A.dylib                0x4300 objc_destructInstance + 80
5  libobjc.A.dylib                0x42a8 _objc_rootDealloc + 80
6  Foundation                     0x327e4 -[NSThread dealloc] + 100
7  Foundation                     0x309d8 __NSFinalizeThreadData + 728
8  CoreFoundation                 0xd92e8 __CFTSDFinalize + 124
9  libsystem_pthread.dylib        0x4f18 _pthread_tsd_cleanup + 620
10 libsystem_pthread.dylib        0x4c88 _pthread_exit + 84
11 libsystem_pthread.dylib        0x7f48 pthread_exit + 88
12 Foundation                     0xdead4 -[NSOrderedSet(NSKeyValueCoding) valueForKeyPath:] + 18
13 Foundation                     0xde724 __NSThread__start__ + 744
14 libsystem_pthread.dylib        0x606c _pthread_start + 136
15 libsystem_pthread.dylib        0x10d8 thread_start + 8
@ruisebas
Copy link
Member

Hi @ad-Jun, thanks for opening this issue.

Could you please:

  • Provide the following the full symbolicated crashlog
  • Describe what is your use case and what APIs you are using
  • Share any reproduction steps and verbose logging if you are able to reproduce this issue in your local environment

All of these will help us identify and root cause this crash.
Thanks!

@ruisebas ruisebas added bug Something isn't working iot Issues related to the IoT SDK labels Jul 24, 2024
@ad-Jun
Copy link
Author

ad-Jun commented Jul 25, 2024

Hi @ruisebas, I am using the AWS IOT APIs, and the crash appears infrequent in my local environment,but appears in product environment reported via firebase.
Here is the Stack trace.

# Crashlytics - Stack trace
# Platform: apple

com.apple.main-thread
0  DefaultsKit                    0x8cc8 type metadata accessor for Defaults + 62 (<compiler-generated>:62)
5  CoreBluetooth                  0x2630c -[CBCentralManager handlePeripheralConnectionCompleted:] + 456
6  CoreBluetooth                  0x6710 -[CBCentralManager handleMsg:args:] + 224
7  CoreBluetooth                  0x65f4 -[CBManager xpcConnectionDidReceiveMsg:args:] + 228
8  CoreBluetooth                  0x64a0 __30-[CBXpcConnection _handleMsg:]_block_invoke + 48
9  libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
10 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
11 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
12 libdispatch.dylib              0xbf64 _dispatch_lane_invoke + 432
13 libdispatch.dylib              0x124b4 _dispatch_main_queue_drain + 748
14 libdispatch.dylib              0x121b8 _dispatch_main_queue_callback_4CF + 44
15 CoreFoundation                 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
16 CoreFoundation                 0x53914 __CFRunLoopRun + 1996
17 CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
18 GraphicsServices               0x11a8 GSEventRunModal + 164
19 UIKitCore                      0x40a90c -[UIApplication _run] + 888
20 UIKitCore                      0x4be9d0 UIApplicationMain + 340
21 UIKitCore                      0x638384 keypath_get_selector_hoverStyle + 11024
25 ???                            0x1b54e5e4c (缺少)

com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1808 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x5008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4f20 mach_msg_overwrite + 436
3  libsystem_kernel.dylib         0x4d60 mach_msg + 24
4  CoreFoundation                 0x53f5c __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x53600 __CFRunLoopRun + 1208
6  CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
7  Foundation                     0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  Foundation                     0xc7c9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9  UIKitCore                      0x41e640 -[UIEventFetcher threadMain] + 420
10 Foundation                     0xde718 __NSThread__start__ + 732
11 libsystem_pthread.dylib        0x606c _pthread_start + 136
12 libsystem_pthread.dylib        0x10d8 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
0  FirebaseCrashlytics            0x21c10 FIRCLSProcessRecordAllThreads + 392 (FIRCLSProcess.c:392)
1  FirebaseCrashlytics            0x21ff0 FIRCLSProcessRecordAllThreads + 423 (FIRCLSProcess.c:423)
2  FirebaseCrashlytics            0x18e74 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  FirebaseCrashlytics            0x1b804 FIRCLSMachExceptionServer + 521 (FIRCLSMachException.c:521)
4  libsystem_pthread.dylib        0x606c _pthread_start + 136
5  libsystem_pthread.dylib        0x10d8 thread_start + 8

com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1808 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x5008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4f20 mach_msg_overwrite + 436
3  libsystem_kernel.dylib         0x4d60 mach_msg + 24
4  CoreFoundation                 0x53f5c __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x53600 __CFRunLoopRun + 1208
6  CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
7  CFNetwork                      0xfdc90 _CFHostIsDomainTopLevel + 108176
8  Foundation                     0xde718 __NSThread__start__ + 732
9  libsystem_pthread.dylib        0x606c _pthread_start + 136
10 libsystem_pthread.dylib        0x10d8 thread_start + 8

com.squareup.SocketRocket.NetworkThread
0  libsystem_kernel.dylib         0x1808 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x5008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4f20 mach_msg_overwrite + 436
3  libsystem_kernel.dylib         0x4d60 mach_msg + 24
4  CoreFoundation                 0x53f5c __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x53600 __CFRunLoopRun + 1208
6  CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
7  Foundation                     0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  AWSIoT                         0x90610 -[_SRRunLoopThread main] + 1905 (AWSSRWebSocket.m:1905)
9  Foundation                     0xde718 __NSThread__start__ + 732
10 libsystem_pthread.dylib        0x606c _pthread_start + 136
11 libsystem_pthread.dylib        0x10d8 thread_start + 8

com.apple.CFSocket.private
0  libsystem_kernel.dylib         0x9474 select$DARWIN_EXTSN + 8
1  libsystem_kernel.dylib         0x9474 __select + 8
2  CoreFoundation                 0xbeb7c __CFSocketManager + 640
3  libsystem_pthread.dylib        0x606c _pthread_start + 136
4  libsystem_pthread.dylib        0x10d8 thread_start + 8

Crashed: Thread
0  libobjc.A.dylib                0x1b60 objc_release_x0 + 16
1  libobjc.A.dylib                0x1b60 objc_release + 16
2  AWSIoT                         0x85274 -[AWSIoTStreamThread .cxx_destruct] + 32 (AWSIoTStreamThread.m:32)
3  libobjc.A.dylib                0x4c3c object_cxxDestructFromClass(objc_object*, objc_class*) + 116
4  libobjc.A.dylib                0x4300 objc_destructInstance + 80
5  libobjc.A.dylib                0x42a8 _objc_rootDealloc + 80
6  Foundation                     0x327e4 -[NSThread dealloc] + 100
7  Foundation                     0x309d8 __NSFinalizeThreadData + 728
8  CoreFoundation                 0xd92e8 __CFTSDFinalize + 124
9  libsystem_pthread.dylib        0x4f18 _pthread_tsd_cleanup + 620
10 libsystem_pthread.dylib        0x4c88 _pthread_exit + 84
11 libsystem_pthread.dylib        0x7f48 pthread_exit + 88
12 Foundation                     0xdead4 -[NSOrderedSet(NSKeyValueCoding) valueForKeyPath:] + 18
13 Foundation                     0xde724 __NSThread__start__ + 744
14 libsystem_pthread.dylib        0x606c _pthread_start + 136
15 libsystem_pthread.dylib        0x10d8 thread_start + 8

com.apple.root.utility-qos.overcommit
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x3070 _pthread_workqueue_addthreads + 44
2  libdispatch.dylib              0x10cb0 _dispatch_root_queue_poke_slow + 312
3  libdispatch.dylib              0x119d4 _dispatch_runloop_queue_xref_dispose + 92
4  libdispatch.dylib              0x29fc _dispatch_xref_dispose + 148
5  CoreFoundation                 0xc0fc __CFRunLoopModeDeallocate + 196
6  CoreFoundation                 0x7888 _CFRelease + 292
7  CoreFoundation                 0xc5a8 __CFBasicHashDrain + 320
8  CoreFoundation                 0x7888 _CFRelease + 292
9  CoreFoundation                 0xdbd9c __CFRunLoopDeallocate + 344
10 CoreFoundation                 0x7888 _CFRelease + 292
11 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
12 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
13 libdispatch.dylib              0x72d8 _dispatch_continuation_pop + 600
14 libdispatch.dylib              0x1a77c _dispatch_source_cancel_callout + 204
15 libdispatch.dylib              0x19dd4 _dispatch_source_invoke + 904
16 libdispatch.dylib              0x15894 _dispatch_root_queue_drain + 392
17 libdispatch.dylib              0x1609c _dispatch_worker_thread2 + 156
18 libsystem_pthread.dylib        0x48f8 _pthread_wqthread + 228
19 libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x4980 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_pthread.dylib        0x10c4 start_wqthread + 8301281474

com.apple.runningboardservices.background-workloop
0  libdispatch.dylib              0xd1e4 _dispatch_workloop_invoke + 1596
1  libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
2  libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
3  libsystem_pthread.dylib        0x4934 _pthread_wqthread + 288
4  libsystem_pthread.dylib        0x10cc start_wqthread + 8

RBSProcessMonitorCalloutQueue
0  libsystem_kernel.dylib         0x68a8 __bsdthread_ctl + 8
1  libsystem_pthread.dylib        0x47b0 _pthread_set_properties_self + 148
2  libdispatch.dylib              0x645c _dispatch_set_priority_and_mach_voucher_slow + 204
3  libdispatch.dylib              0x6624 _dispatch_set_priority_and_voucher_slow + 232
4  libdispatch.dylib              0xb3b0 _dispatch_lane_serial_drain + 668
5  libdispatch.dylib              0xbf64 _dispatch_lane_invoke + 432
6  libdispatch.dylib              0xd284 _dispatch_workloop_invoke + 1756
7  libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
8  libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
9  libsystem_pthread.dylib        0x4934 _pthread_wqthread + 288
10 libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_pthread.dylib        0x10c4 start_wqthread + 8301281474

Thread
0  libsystem_pthread.dylib        0x10c4 start_wqthread + 8301281474

Thread
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x4980 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x73ec __semwait_signal + 8
1  libsystem_c.dylib              0x165f0 nanosleep + 220
2  libsystem_c.dylib              0x16508 usleep + 68
3  AWSIoT                         0x8a990 -[AWSMQTTSession error:] + 666 (AWSMQTTSession.m:666)
4  AWSIoT                         0x85ad4 -[AWSMQTTDecoder stream:handleEvent:] + 165 (AWSMQTTDecoder.m:165)
5  CoreFoundation                 0xc26cc _inputStreamCallbackFunc + 76
6  CoreFoundation                 0xc1cc8 _signalEventSync + 216
7  CoreFoundation                 0xc1b78 _cfstream_shared_signalEventSync + 392
8  CoreFoundation                 0x56834 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
9  CoreFoundation                 0x567c8 __CFRunLoopDoSource0 + 176
10 CoreFoundation                 0x54298 __CFRunLoopDoSources0 + 244
11 CoreFoundation                 0x53484 __CFRunLoopRun + 828
12 CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
13 Foundation                     0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
14 AWSIoT                         0x849bc -[AWSIoTStreamThread main] + 88 (AWSIoTStreamThread.m:88)
15 Foundation                     0xde718 __NSThread__start__ + 732
16 libsystem_pthread.dylib        0x606c _pthread_start + 136
17 libsystem_pthread.dylib        0x10d8 thread_start + 8

Thread
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x4980 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x10cc start_wqthread + 8

com.amazon.aws.iot.timer-queue
0  libsystem_kernel.dylib         0x1808 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x5008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4f20 mach_msg_overwrite + 436
3  libsystem_kernel.dylib         0x4d60 mach_msg + 24
4  CoreFoundation                 0x53f5c __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x53600 __CFRunLoopRun + 1208
6  CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
7  Foundation                     0xc7e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  AWSIoT                         0x6732c -[AWSIoTMQTTClient scheduleReconnection] + 1326 (AWSIoTMQTTClient.m:1326)
9  AWSIoT                         0x63e5c __43-[AWSIoTMQTTClient initiateReconnectTimer:]_block_invoke + 779 (AWSIoTMQTTClient.m:779)
10 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
11 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
12 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
13 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
14 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
15 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
16 libsystem_pthread.dylib        0x4934 _pthread_wqthread + 288
17 libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x4980 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_pthread.dylib        0x10c4 start_wqthread + 8301281474

Thread
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x4980 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x10cc start_wqthread + 8

NetworkConnectivityMonitor
0  ???                            0x1b54b0d74 (缺少)
1  ???                            0x1b54b0d24 (缺少)
2  ???                            0x1b54b09b8 (缺少)
3  ???                            0x1b54b06e8 (缺少)
4  libswiftCore.dylib             0x3f8088 swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 2104
5  libswiftCore.dylib             0x3f6b48 swift_conformsToProtocolCommon + 136
6  libswiftCore.dylib             0x39a9f0 swift::_conformsToProtocol(swift::OpaqueValue const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptorRef<swift::InProcess>, swift::TargetWitnessTable<swift::InProcess> const**) + 60
7  libswiftCore.dylib             0x3a2be4 _conformsToProtocols(swift::OpaqueValue const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetExistentialTypeMetadata<swift::InProcess> const*, swift::TargetWitnessTable<swift::InProcess> const**) + 160
8  libswiftCore.dylib             0x3a18a8 tryCastToConstrainedOpaqueExistential(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 56
9  libswiftCore.dylib             0x3a0068 tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 992
10 libswiftCore.dylib             0x3a040c tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 1924
11 libswiftCore.dylib             0x39fb14 swift_dynamicCast + 208
12 libswiftCore.dylib             0xd85b4 _print_unlocked<A, B>(_:_:) + 872
13 libswiftCore.dylib             0x1a0c44 specialized _print<A>(_:separator:terminator:to:) + 184
14 libswiftCore.dylib             0x19fe9c print(_:separator:terminator:) + 192
16 Network                        0x21bde8 partial apply for closure #1 in NWPathMonitor.startLocked(lockedState:) + 92
17 Network                        0x21bd68 thunk for @escaping @callee_guaranteed @Sendable () -> () + 36
18 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
19 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
20 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
21 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
22 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
23 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
24 libsystem_pthread.dylib        0x4934 _pthread_wqthread + 288
25 libsystem_pthread.dylib        0x10cc start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1590 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x4980 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x10cc start_wqthread + 8

@ruisebas
Copy link
Member

Thanks for providing the crashlog.
Could you also tell us which IoT APIs you are using? So we can debug that use case and try to identify what could be causing your issue.

Thanks!

@ruisebas ruisebas added the pending-community-response Issue is pending response from the issue requestor label Jul 29, 2024
@ad-Jun
Copy link
Author

ad-Jun commented Jul 31, 2024

Actually I don`t know which Iot APIS cause the crash. It looks like it happened when AWSIoTStreamThread dealloc.

@ruisebas
Copy link
Member

I meant which APIs you are calling in your code.
For example, are you connecting using AWSIoTDataManager.connect(withClientId:cleanSession: certificateId:statusCallback:), AWSIoTDataManager. connectUsingALPN(withClientId:cleanSession: certificateId:statusCallback:), or AWSIoTDataManager. connectUsingWebSocket(withClientId:cleanSession:statusCallback:)?.

I guess you're also calling AWSIoTDataManager.subscribe(toTopi:qos:messageCallback:)?

Knowing this might help us diagnose the issue. Also, please enable verbose logging in your local environment:

AWSDDLog.sharedInstance.logLevel = .verbose
AWSDDLog.add(AWSDDOSLogger.sharedInstance)

And please share the logs with us whenever a crash happens. I understand you said it happens infrequently, but it will be very helpful to have verbose logging once it does.

Thanks!

@ruisebas
Copy link
Member

ruisebas commented Aug 2, 2024

We've release some IoT improvements in version 2.36.7.
Could you please upgrade your dependency and check it out?

@ad-Jun
Copy link
Author

ad-Jun commented Dec 13, 2024

The problem still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iot Issues related to the IoT SDK pending-community-response Issue is pending response from the issue requestor
Projects
None yet
Development

No branches or pull requests

2 participants