Crash on RTMPStream.init addEventListener
jhays opened this issue · comments
Describe the bug
I rolled out a feature in an app using HaishinKit for streaming, and our crash reporting started detecting some crashes that are occurring for some users within RTMPStream init(connection: RTMPConnection)
, on this line:
rtmpConnection.addEventListener(.rtmpStatus, selector: #selector(on(status:)), observer: self)
Any ideas what could cause this, or how to mitigate it?
Crashed: com.apple.root.user-initiated-qos.cooperative
EXC_BAD_ACCESS 0x0000000000000024
Crashed: com.apple.root.user-initiated-qos.cooperative
0 libswiftCore.dylib 0x404448 swift::WeakReference::unknownLoadStrong() + 60
1 Citizen 0x1b71018 EventDispatcher.addEventListener(_:selector:observer:useCapture:) + 100 (EventDispatcher.swift:100)
2 Citizen 0x1b57d44 RTMPStream.init(connection:) + 312 (RTMPStream.swift:312)
3 Citizen 0x19fc804 CamBroadcastProviderHaishinKit.start(settings:) + 58 (CamBroadcastProviderHaishinKit.swift:58)
4 Citizen 0x1aa3790 closure #2 in closure #1 in BroadcastStreamReducer.body.getter + 39 (CamBroadcastProvider.swift:39)
5 libswift_Concurrency.dylib 0x41948 swift::runJobInEstablishedExecutorContext(swift::Job*) + 416
6 libswift_Concurrency.dylib 0x42868 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
7 libdispatch.dylib 0x15944 _dispatch_root_queue_drain + 396
8 libdispatch.dylib 0x16158 _dispatch_worker_thread2 + 164
9 libsystem_pthread.dylib 0xda0 _pthread_wqthread + 228
10 libsystem_pthread.dylib 0xb7c start_wqthread + 8
To Reproduce
I'm not sure what the repro steps are yet, as I haven't observed the crash myself. However we have seen this occur 10 times in our crash reporting from real users.
Expected behavior
RTMPStream init without crashing
Version
1.4.2
Smartphone info.
Crash has been logged on:
iOS 16.5.1
iPhone 14 Pro Max
Additional context
No response
Screenshots
No response
Relevant log output
No response
Looking at the crash log, it seems like the reference is being deallocated at the caller's side, causing the crash.
Since I cannot change the current process, I would like the caller to try and experiment with it.