opentok / opentok-ios-sdk-samples-swift

Sample applications using the OpenTok iOS SDK in Swift
https://tokbox.com/
MIT License
137 stars 65 forks source link

Crash on OTPublisher instance creation #193

Closed TheSuperiorStanislav closed 1 year ago

TheSuperiorStanislav commented 1 year ago

Describe the bug App crashes with this message on OTPublisher

To Reproduce Create a session, connect to a session, create OTPublisher, and disconnect from the session. Repeat multiple times until crashes. Sometimes it happened on the first attempt

Expected behavior The app does not crash

Device (please complete the following information):

Additional context Stacktrace

Application Specific Information:
*** -[AVCaptureSession startRunning] startRunning may not be called between calls to beginConfiguration and commitConfiguration

Thread 18 Crashed:
0   CoreFoundation                  0x300a58d1c         <redacted>
1   libobjc.A.dylib                 0x32fb20ee4         objc_exception_throw
2   AVFCapture                      0x3476bc4f0         <redacted>
3   libdispatch.dylib               0x300407094         <redacted>
4   libdispatch.dylib               0x300408094         <redacted>
5   libdispatch.dylib               0x3003ec74c         <redacted>
6   libdispatch.dylib               0x3003ecdec         <redacted>
7   libsystem_pthread.dylib         0x3b7073dd4         _pthread_wqthread
8   libsystem_pthread.dylib         0x3b707393c         start_wqthread

Thread 0 name: Main thread
0   libsystem_kernel.dylib          0x375b92aac         mach_msg_trap
1   libsystem_kernel.dylib          0x375b9307c         mach_msg
2   CoreFoundation                  0x3009ccd88         <redacted>
3   CoreFoundation                  0x3009d1090         <redacted>
4   CoreFoundation                  0x3009e4250         CFRunLoopRunSpecific
5   AVFCore                         0x3125c66ac         <redacted>
6   AVFCapture                      0x3477305f4         <redacted>
7   AVFCapture                      0x3476acd44         <redacted>
8   WorkApp                         0x2052181e4         __52-[OTVideoCaptureIOSDefault setCaptureSessionPreset:]_block_invoke
9   libdispatch.dylib               0x300408094         <redacted>
10  libdispatch.dylib               0x3003ea464         <redacted>
11  WorkApp                         0x2052180b4         -[OTVideoCaptureIOSDefault setCaptureSessionPreset:]
12  WorkApp                         0x205212de0         -[OTPublisher initWithDelegate:settings:]
13  WorkApp                         0x2042485ec         OTPublisher.init
14  WorkApp                         0x204248590         OTPublisher.__allocating_init
emilyvon commented 1 year ago

I am also facing this issue after upgrading to v2.24.2 in my own project (previously running v2.21.0 without this problem).

The crash happens quite randomly but I managed to reproduce it using the sample app in this repo called "Basic-Video-Chat".

What I have modified in the sample app:

Steps to reproduce (intermittently - I had done these steps for the whole day non stop and only happened twice):

  1. Build app from Xcode to physical iPhone running 15.6.1
  2. App trying to connect to the session for the first time after the app is loaded (initiating a connect action after viewDidLoad())
  3. App crashes at attempting to return an OTPublisher

Screenshot 2023-03-24 at 3 53 28 pm

Screenshot 2023-03-24 at 3 53 31 pm

v-kpheng commented 1 year ago

Thanks for letting us know about this issue.

We've been able to reproduce and have a fix in mind https://jira.vonage.com/browse/VIDCS-13. It should be fixed in the upcoming 2.25.0 release.

beHaze commented 1 year ago

Fixed with 2.25.0 release