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

Multiple Class Implementations Warnings and Crash on iOS 17 When Starting Stream with LiveKit v1.1.2 #257

Closed
isandeepj opened this issue Oct 19, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@isandeepj
Copy link

isandeepj commented Oct 19, 2023

Describe the bug
When starting a stream using LiveKit on iOS 17, I encounter warnings indicating that multiple class implementations exist in the runtime for several _NSZombie_LiveKitClient classes. This could potentially lead to unpredictable behavior.

SDK Version
LiveKit Client SDK for Swift v1.1.2

iOS Version
iOS 17

Steps to Reproduce

  1. Implement LiveKit Client SDK for Swift in the app.
  2. Start a stream using LiveKit functionalities.
  3. Observe the console logs for warnings.
  4. Continue to use the application until a crash occurs.

Expected behavior
The application should stream without warnings or crashes.

Screenshots
N/A

Logs

objc[17360]: Class _NSZombie_LiveKitClient.MediaSourceStatistics is implemented in both ?? (0x28b012280) and ?? (0x28b005bf0). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.CodecStatistics is implemented in both ?? (0x28b01de90) and ?? (0x28b1e4600). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.TransportStatistics is implemented in both ?? (0x28b1e4b10) and ?? (0x28b01d020). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.CertificateStatistics is implemented in both ?? (0x28b1e4db0) and ?? (0x28b1e4de0). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.IceCandidatePairStatistics is implemented in both ?? (0x28b01e130) and ?? (0x28b1e4e40). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.LocalIceCandidateStatistics is implemented in both ?? (0x28b1e4e70) and ?? (0x28b01e190). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.RemoteIceCandidateStatistics is implemented in both ?? (0x28b07a9a0) and ?? (0x28b01c660). One of the two will be used. Which one is undefined.

** Crash Stack Trace**

Crashed: livekit.multicast
0  CoreFoundation                 0xc9cc _CFRelease + 48
1  LiveKitClient                  0x10e5b8 $s13LiveKitClient26InboundRtpStreamStatisticsCfETo + 40
...
41 libsystem_pthread.dylib        0x1a04 start_wqthread + 116

Crashed: livekit.multicast
0  CoreFoundation                 0x77bd4 _CFRelease + 4
1  libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 112
2  libobjc.A.dylib                0x5500 objc_destructInstance + 92
3  libobjc.A.dylib                0xda7c _objc_rootDealloc + 52
4  libswiftCore.dylib             0x2e9118 swift_arrayDestroy + 112
5  libswiftCore.dylib             0x7a050 _ContiguousArrayStorage.__deallocating_deinit + 92
6  libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 52
7  libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 112
8  LiveKitClient                  0x122aa0 objc_destructInstance + 92
9  libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 52
10 libobjc.A.dylib                0x5500 objc_destructInstance + 112
11 libobjc.A.dylib                0xda7c _objc_rootDealloc + 92
12 Combine                        0x14d54 CurrentValueSubject.deinit + 52
13 Combine                        0x9fa60 CurrentValueSubject.__deallocating_deinit + 112
14 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 92
15 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 52
16 LiveKitClient                  0x10238c <redacted> + 112
17 LiveKitClient                  0x1023b4 objc_destructInstance + 92
18 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 52
19 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 112
20 LiveKitClient                  0x1184a0 objc_destructInstance + 92
21 libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 52
22 libobjc.A.dylib                0x5500 objc_destructInstance + 112
23 libobjc.A.dylib                0xda7c _objc_rootDealloc + 92
24 LiveKitClient                  0x118398 _objc_rootDealloc + 52
25 LiveKitClient                  0x118404 <redacted> + 112
26 LiveKitClient                  0x11ffd8 objc_destructInstance + 92
27 Combine                        0x14d54 CurrentValueSubject.deinit + 52
28 Combine                        0x9fa60 CurrentValueSubject.__deallocating_deinit + 112
29 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 92
30 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 52
31 LiveKitClient                  0x10238c <redacted> + 112
32 LiveKitClient                  0x1023b4 objc_destructInstance + 92
33 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 52
34 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 112
35 libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 92
36 libobjc.A.dylib                0x5500 objc_destructInstance + 52
37 libobjc.A.dylib                0xda7c _objc_rootDealloc + 112
38 LiveKitClient                  0x11e590 objc_destructInstance + 92
39 LiveKitClient                  0x11e5f8 _objc_rootDealloc + 52
40 LiveKitClient                  0xc7684 <redacted> + 112
41 LiveKitClient                  0xc76b4 objc_destructInstance + 92
42 LiveKitClient                  0xc55dc _objc_rootDealloc + 52
43 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 112
44 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 92
45 LiveKitClient                  0x34eec _objc_rootDealloc + 52
46 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 112
47 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 92
48 libsystem_blocks.dylib         0x16cc _call_dispose_helpers_excp + 52
49 libsystem_blocks.dylib         0x135c _Block_release + 112
50 libdispatch.dylib              0x64780 _dispatch_client_callout + 92
51 libdispatch.dylib              0xa298 _dispatch_lane_serial_drain$VARIANT$mp + 52
52 libdispatch.dylib              0xad70 _dispatch_lane_invoke$VARIANT$mp + 112
53 libdispatch.dylib              0x14dc8 _dispatch_workloop_worker_thread + 92
54 libsystem_pthread.dylib        0x1bd0 _pthread_wqthread + 52
55 libsystem_pthread.dylib        0x1720 start_wqthread + 112
@isandeepj isandeepj added the bug Something isn't working label Oct 19, 2023
@hiroshihorie
Copy link
Member

I am not able to reproduce this one.
Pretty odd you are seeing:

objc[17360]: Class _NSZombie_LiveKitClient.MediaSourceStatistics is implemented in both ?? (0x28b012280) and ?? (0x28b005bf0). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.CodecStatistics is implemented in both ?? (0x28b01de90) and ?? (0x28b1e4600). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.TransportStatistics is implemented in both ?? (0x28b1e4b10) and ?? (0x28b01d020). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.CertificateStatistics is implemented in both ?? (0x28b1e4db0) and ?? (0x28b1e4de0). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.IceCandidatePairStatistics is implemented in both ?? (0x28b01e130) and ?? (0x28b1e4e40). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.LocalIceCandidateStatistics is implemented in both ?? (0x28b1e4e70) and ?? (0x28b01e190). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.RemoteIceCandidateStatistics is implemented in both ?? (0x28b07a9a0) and ?? (0x28b01c660). One of the two will be used. Which one is undefined.

Is there something unique with your setup ?

@isandeepj
Copy link
Author

isandeepj commented Oct 25, 2023

Hello @hiroshihorie ,

Thank you for your prompt response.

I would like to provide some additional details regarding the environment and setup in which these issues are occurring:

Development Environment:

  • Xcode Version: 15.0

Configuration:

  • Zombie Objects: I have enabled Zombie Objects in my Xcode project schema to check for memory management issues, as we've encountered some related crash logs.

Implementation Details:

I am currently utilizing own camera for broadcaster purposes only, with the following configuration:

let cameraCaptureOptions = CameraCaptureOptions(position: .front, preferredFormat: nil, dimensions: .h360_169, fps: 20)
let options = RoomOptions(defaultCameraCaptureOptions: cameraCaptureOptions, adaptiveStream: false, dynacast: false)
self.roomOptions = options
self.room = Room(delegate: self, roomOptions: roomOptions)

Streamer/broadcaster settings

self.localVideoTrack = LocalVideoTrack.createBufferTrack(name: Track.cameraName, source: .camera, options: BufferCaptureOptions(dimensions: .h720_169, fps: 30))
self.localAudioTrack = LocalAudioTrack.createTrack(options: roomOptions.defaultAudioCaptureOptions)

Co-streamer settings

self.localVideoTrack = LocalVideoTrack.createCameraTrack(options: roomOptions.defaultCameraCaptureOptions)
self.localAudioTrack = LocalAudioTrack.createTrack(options: roomOptions.defaultAudioCaptureOptions)

Observed Behavior:

Upon running the application with the above setup, I encounter the following runtime warnings:

objc[17360]: Class _NSZombie_LiveKitClient.MediaSourceStatistics is implemented in both ?? (0x28b012280) and ?? (0x28b005bf0). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.CodecStatistics is implemented in both ?? (0x28b01de90) and ?? (0x28b1e4600). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.TransportStatistics is implemented in both ?? (0x28b1e4b10) and ?? (0x28b01d020). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.CertificateStatistics is implemented in both ?? (0x28b1e4db0) and ?? (0x28b1e4de0). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.IceCandidatePairStatistics is implemented in both ?? (0x28b01e130) and ?? (0x28b1e4e40). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.LocalIceCandidateStatistics is implemented in both ?? (0x28b1e4e70) and ?? (0x28b01e190). One of the two will be used. Which one is undefined.
objc[17360]: Class _NSZombie_LiveKitClient.RemoteIceCandidateStatistics is implemented in both ?? (0x28b07a9a0) and ?? (0x28b01c660). One of the two will be used. Which one is undefined.

I am wondering if there might be something unique about my setup that could be leading to these issues, and I would appreciate any insights or recommendations you might have to resolve this problem.

Thank you in advance for your assistance.

Best,
Sandeep

@davidzhao
Copy link
Member

@isandeepj could you create a minimal project that is able to reproduce these warnings? From the warnings it looks like your app is linking against two copies of LiveKit SDK. Though I could be wrong and something else is going on.

@isandeepj
Copy link
Author

@davidzhao & @hiroshihorie ,

I am experiencing a challenging issue with the LiveKit SDK integration into my iOS project on Xcode 15. I have tried installing the SDK using both Swift Package Manager and CocoaPods, each in separate instances and on a completely fresh project. However, the outcome has been the same, with persistent errors during runtime.

The specific warnings I am receiving are as follows:

objc[1527]: Class _NSZombie_LiveKit.MediaSourceStatistics is implemented in both ?? (0x280994000) and ?? (0x280993a20). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.TrackStatistics is implemented in both ?? (0x2809dce70) and ?? (0x2809c8c60). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.CodecStatistics is implemented in both ?? (0x2809bccc0) and ?? (0x2809dcf60). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.TransportStatistics is implemented in both ?? (0x2809ce010) and ?? (0x2809ce070). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.CertificateStatistics is implemented in both ?? (0x2809d9200) and ?? (0x2809d47e0). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.LocalIceCandidateStatistics is implemented in both ?? (0x2809f9f20) and ?? (0x2809f9ec0). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.RemoteIceCandidateStatistics is implemented in both ?? (0x2809f3570) and ?? (0x2809fc540). One of the two will be used. Which one is undefined.
objc[1527]: Class _NSZombie_LiveKit.RemoteInboundRtpStreamStatistics is implemented in both ?? (0x280e37d20) and ?? (0x280e33930). One of the two will be used. Which one is undefined.

These warnings seem to indicate that there are multiple implementations of the LiveKit SDK classes in my project’s runtime, which is causing ambiguity about which implementation should be used.

I have made sure to clean the build folder, remove all derived data, and even delete and re-install all the dependencies. Despite these efforts, the warnings persist.

Can you please guide me on how to resolve these issues? Any help or insights would be greatly appreciated.

Thank you

Screenshot 2023-10-26 at 7 40 18 PM

@hiroshihorie
Copy link
Member

hiroshihorie commented Oct 26, 2023

What's your Xcode version ? and can you try with Zombie Objects off ?
Can you try changing shcema settings ? I think there is something unique to your setup.

@isandeepj
Copy link
Author

Xcode 15.0.1 version is used, and if we turn off Zombie Objects then not showing the above error.

@hiroshihorie any thoughts on below crash logs?

0  CoreFoundation                 0xc9cc _CFRelease + 48
1  LiveKitClient                  0x10e5b8 $s13LiveKitClient26InboundRtpStreamStatisticsCfETo + 40
...
41 libsystem_pthread.dylib        0x1a04 start_wqthread + 116
0  CoreFoundation                 0x77bd4 _CFRelease + 4
1  libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 112
2  libobjc.A.dylib                0x5500 objc_destructInstance + 92
3  libobjc.A.dylib                0xda7c _objc_rootDealloc + 52
4  libswiftCore.dylib             0x2e9118 swift_arrayDestroy + 112
5  libswiftCore.dylib             0x7a050 _ContiguousArrayStorage.__deallocating_deinit + 92
6  libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 52
7  libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 112
8  LiveKitClient                  0x122aa0 objc_destructInstance + 92
9  libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 52
10 libobjc.A.dylib                0x5500 objc_destructInstance + 112
11 libobjc.A.dylib                0xda7c _objc_rootDealloc + 92
12 Combine                        0x14d54 CurrentValueSubject.deinit + 52
13 Combine                        0x9fa60 CurrentValueSubject.__deallocating_deinit + 112
14 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 92
15 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 52
16 LiveKitClient                  0x10238c <redacted> + 112
17 LiveKitClient                  0x1023b4 objc_destructInstance + 92
18 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 52
19 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 112
20 LiveKitClient                  0x1184a0 objc_destructInstance + 92
21 libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 52
22 libobjc.A.dylib                0x5500 objc_destructInstance + 112
23 libobjc.A.dylib                0xda7c _objc_rootDealloc + 92
24 LiveKitClient                  0x118398 _objc_rootDealloc + 52
25 LiveKitClient                  0x118404 <redacted> + 112
26 LiveKitClient                  0x11ffd8 objc_destructInstance + 92
27 Combine                        0x14d54 CurrentValueSubject.deinit + 52
28 Combine                        0x9fa60 CurrentValueSubject.__deallocating_deinit + 112
29 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 92
30 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 52
31 LiveKitClient                  0x10238c <redacted> + 112
32 LiveKitClient                  0x1023b4 objc_destructInstance + 92
33 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 52
34 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 112
35 libobjc.A.dylib                0x10a0 object_cxxDestructFromClass(objc_object*, objc_class*) + 92
36 libobjc.A.dylib                0x5500 objc_destructInstance + 52
37 libobjc.A.dylib                0xda7c _objc_rootDealloc + 112
38 LiveKitClient                  0x11e590 objc_destructInstance + 92
39 LiveKitClient                  0x11e5f8 _objc_rootDealloc + 52
40 LiveKitClient                  0xc7684 <redacted> + 112
41 LiveKitClient                  0xc76b4 objc_destructInstance + 92
42 LiveKitClient                  0xc55dc _objc_rootDealloc + 52
43 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 112
44 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 92
45 LiveKitClient                  0x34eec _objc_rootDealloc + 52
46 libswiftCore.dylib             0x2f7184 _swift_release_dealloc + 112
47 libswiftCore.dylib             0x2f8060 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 92
48 libsystem_blocks.dylib         0x16cc _call_dispose_helpers_excp + 52
49 libsystem_blocks.dylib         0x135c _Block_release + 112
50 libdispatch.dylib              0x64780 _dispatch_client_callout + 92
51 libdispatch.dylib              0xa298 _dispatch_lane_serial_drain$VARIANT$mp + 52
52 libdispatch.dylib              0xad70 _dispatch_lane_invoke$VARIANT$mp + 112
53 libdispatch.dylib              0x14dc8 _dispatch_workloop_worker_thread + 92
54 libsystem_pthread.dylib        0x1bd0 _pthread_wqthread + 52
55 libsystem_pthread.dylib        0x1720 start_wqthread + 112

@hiroshihorie
Copy link
Member

My guess is that it's related to DispatchQueueTimer which i patched already in v1,
or some issue when the TrackStatistics get swapped with the new value.

Do you read the Track.statistics property at all ?

@hiroshihorie
Copy link
Member

I've released v1.1.5, can you try it out ?

@hiroshihorie
Copy link
Member

WebRTC symbols in v2 are prefixed with "LK" I don't think you will get any "Multiple class implementations exist" error.
Will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants