opentok / opentok-ios-sdk-samples

Example applications that use the OpenTok iOS SDK
https://tokbox.com/developer/sdks/ios
MIT License
200 stars 116 forks source link

Crash: OTSession initWithToken:error: #275

Closed DimaIgorevich closed 1 year ago

DimaIgorevich commented 1 year ago

Describe the bug When I'm start working with connect session via token, after init flow of OTSession instance catch the crash. It start raise error when update OpenTok version from 2.21.3 to 2.22.0 or 2.23.0 or 2.24.0

To Reproduce Related to sdk version 2.22.0

OTError *result = nil;

if (session.sessionConnectionStatus == OTSessionConnectionStatusConnected) { return; }

[session connectWithToken:token error:&error];

Application(11135,0x170373000) malloc: error for object 0x2822a1b48: pointer being freed was not allocated Application(11135,0x170373000) malloc: error for object 0x2822a1b48: pointer being freed was not allocated Application(11135,0x170373000) malloc: *** set a breakpoint in malloc_error_break to debug

Screenshots

Device (please compete the following information):

On version 2.21.3 all works fine.

IGitGotIt commented 1 year ago

Does this happen with any session id and token combination? Can you try with a new set of credentials? Do you have the crash trace? (Output of bt all console command will help.) Thanks

DimaIgorevich commented 1 year ago

Hello, yes with different session and token it happens. Crash trace:

thread #1, queue = 'com.apple.main-thread' frame #0: 0x00000001f3d7241c libsystem_kernel.dylib__psynch_cvwait + 8 frame #1: 0x00000002041db06c libsystem_pthread.dylib_pthread_cond_wait + 1232 frame #2: 0x0000000100f49954 Application Connectotk_thread_cond_wait + 64 frame #3: 0x0000000100f5983c Application Connectotk_ev_send_msg_sync + 360 frame #4: 0x0000000100f5a3f4 Application Connectotk_session_connect + 76 frame #5: 0x0000000100f6a794 Application Connectotc_session_connect_to_host + 128 frame #6: 0x0000000100f0952c Application Connect-[OTSession connectWithToken:error:] + 348 frame #7: 0x0000000100c79160 Application Connect-[OpenTokConference enableConnectionWithToken:](self=0x000000028004cdd0, _cmd="enableConnectionWithToken:", token=@"T1==cGFydG5lcl9pZD00NjA1NTM5MiZzaWc9ODI1MWJjNGUyNDc0Mjg4Mjc0ZDlmMGM5YTVjNTQ1ZTAyMjAwOGM3MjpzZXNzaW9uX2lkPTJfTVg0ME5qQTFOVE01TW40eUxqSXhMamc1TGpCLU1UWTNORFkwTVRrd01UZ3hNSDUxT1VGMFdVcHFNVlZzYWpFM2RIVkhPQzh4S3k5NGFuWi1mbjQmY3JlYXRlX3RpbWU9MTY3NDY0ODgxNiZub25jZT0tMTI4NDE5MTM0OCZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNjc1MjUzNjE2JmNvbm5lY3Rpb25fZGF0YT0rKysrJTdCJTIybmFtZSUyMiUzQSslMjJEaW1wJTIyJTJDJTBBKysrKyUyMnJvbGUlMjIlM0ErJTIyVUlfSU5URVJQUkVURVIlMjIlMkMlMEErKysrJTIyY2hhaXJwZXJzb24lMjIlM0ErZmFsc2UlMkMlMEErKysrJTIyYXV0aFRva2VuJTIyJTNBKyUyMmV5SmhiR2NpT2lKSVV6VXhNaUo5LmV5SmxlSEFpT2pFMk56UTJPVGt5TVRBc0ltcDBhU0k2SWpsbE4yRXpaREprTFdJelptWXRORGN4WWkxaU5XTmhMVGMyWkRVM1pqbG1NekV6TWlJc0luTjFZaUk2SWtScGJYQWlMQ0pwYzNNaU9pSlZTVjlKVGxSRlVsQlNSVlJGVWlJc0ltVjJaVzUwU1dRaU9pSm1PV0l5TlRBNU15MDJOekF6TFRRek5qSXRZVGxoTUMxak9HVTFNRGRqT0RGa1pqZ2lMQ0pqYUdGcGNuQmxjbk52YmlJNlptRnNjMlY5Lkk2QXAweXZtQl9jS0JObWJHV3pOYUxTQUJ0TVJLdEs2cjBHNV8xNEN0MVhrYzE0a2lnaEwyeV85azlnY1I4dEt0eGVCNFlIekNRQW0wWUxUcU1KLUlnJTIyJTJDJTBBKysrKyUyMnVzZXJJZCUyMiUzQSslMjI") at OpenTokConference.m:267:3 frame #8: 0x0000000100c79a70 Application Connect-[OpenTokConference prepareForListeningCompletion:](self=0x000000028004cdd0, _cmd="prepareForListeningCompletion:", completion=0x0000000100cc7d48) at OpenTokConference.m:325:19 frame #9: 0x0000000100c780bc Application Connect-[OpenTokConference connectCompletion:](self=0x000000028004cdd0, _cmd="connectCompletion:", completion=0x0000000100cc7d48) at OpenTokConference.m:152:9 frame #10: 0x0000000100cc7c04 Application Connect-[Communication connectSessionsWithInfos:commonErrorText:completion:](self=0x0000000281843f70, _cmd="connectSessionsWithInfos:commonErrorText:completion:", sessionInfos=@"1 element", commonErrorText=0x93ccfeab85f34e17, completion=0x0000000100ca39fc) at Communication.m:140:9 frame #11: 0x0000000100ca3984 Application Connect51-[InterviewVC connectVideoStreamingSessionIfNeeded]_block_invoke(.block_descriptor=0x00000002835c5800, pickedListeningSession=0x0000000282efd600) at InterviewVC.m:2430:9 frame #12: 0x0000000100c94f28 Application Connect__57-[InterviewVC updateSessionToken:incoming:visible:block:]_block_invoke_2.133(.block_descriptor=0x000000028358bc30) at InterviewVC.m:1101:13 frame #13: 0x00000001041cc5a8 libdispatch.dylib_dispatch_call_block_and_release + 32 frame #14: 0x00000001041ce05c libdispatch.dylib_dispatch_client_callout + 20 frame #15: 0x00000001041de810 libdispatch.dylib_dispatch_main_queue_drain + 1196 frame #16: 0x00000001041de354 libdispatch.dylib_dispatch_main_queue_callback_4CF + 44 frame #17: 0x00000001b720a6f8 CoreFoundationCFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 frame #18: 0x00000001b71ec058 CoreFoundation`CFRunLoopRun + 2036 frame #19: 0x00000001b71f0ed4 CoreFoundationCFRunLoopRunSpecific + 612 frame #20: 0x00000001f04f2368 GraphicsServicesGSEventRunModal + 164 frame #21: 0x00000001b96cf3d0 UIKitCore-[UIApplication _run] + 888 frame #22: 0x00000001b96cf034 UIKitCoreUIApplicationMain + 340 frame #23: 0x0000000100cce77c Application Connectmain(argc=1, argv=0x000000016f1b36c0) at main.m:14:16 frame #24: 0x00000001d5858960 dyldstart + 2528 thread #3, name = 'gputools.smt_poll.0x283b5f760' frame #0: 0x00000001f3d72008 libsystem_kernel.dylib__semwait_signal + 8 frame #1: 0x00000001be7927d8 libsystem_c.dylibnanosleep + 220 frame #2: 0x00000001be7934a4 libsystem_c.dylibusleep + 68 frame #3: 0x0000000102b2531c GPUToolsCapturesmt_poll_thread_entry(void*) + 108 frame #4: 0x00000002041d46cc libsystem_pthread.dylib_pthread_start + 148 thread #7, name = 'com.apple.uikit.eventfetch-thread' frame #0: 0x00000001f3d71b48 libsystem_kernel.dylibmach_msg2_trap + 8 frame #1: 0x00000001f3d84008 libsystem_kernel.dylibmach_msg2_internal + 80 frame #2: 0x00000001f3d84248 libsystem_kernel.dylibmach_msg_overwrite + 388 frame #3: 0x00000001f3d7208c libsystem_kernel.dylibmach_msg + 24 frame #4: 0x00000001b71eaaf0 CoreFoundationCFRunLoopServiceMachPort + 160 frame #5: 0x00000001b71ebd34 CoreFoundation`CFRunLoopRun + 1232 frame #6: 0x00000001b71f0ed4 CoreFoundationCFRunLoopRunSpecific + 612 frame #7: 0x00000001b158e334 Foundation-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 frame #8: 0x00000001b158e21c Foundation-[NSRunLoop(NSRunLoop) runUntilDate:] + 64 frame #9: 0x00000001b980433c UIKitCore-[UIEventFetcher threadMain] + 436 frame #10: 0x00000001b15a7808 Foundation__NSThread__start__ + 716 frame #11: 0x00000002041d46cc libsystem_pthread.dylib_pthread_start + 148 thread #10 frame #0: 0x00000002041d3b90 libsystem_pthread.dylibstart_wqthread thread #14, name = 'com.apple.NSURLConnectionLoader' frame #0: 0x00000001f3d71b48 libsystem_kernel.dylibmach_msg2_trap + 8 frame #1: 0x00000001f3d84008 libsystem_kernel.dylibmach_msg2_internal + 80 frame #2: 0x00000001f3d84248 libsystem_kernel.dylibmach_msg_overwrite + 388 frame #3: 0x00000001f3d7208c libsystem_kernel.dylibmach_msg + 24 frame #4: 0x00000001b71eaaf0 CoreFoundationCFRunLoopServiceMachPort + 160 frame #5: 0x00000001b71ebd34 CoreFoundation`CFRunLoopRun + 1232 frame #6: 0x00000001b71f0ed4 CoreFoundationCFRunLoopRunSpecific + 612 frame #7: 0x00000001b85485a8 CFNetwork_lldb_unnamed_symbol14247 + 392 frame #8: 0x00000001b15a7808 Foundation`NSThreadstart + 716 frame #9: 0x00000002041d46cc libsystem_pthread.dylib_pthread_start + 148 thread #16 frame #0: 0x00000002041d3b90 libsystem_pthread.dylibstart_wqthread thread #17 frame #0: 0x00000002041d3b90 libsystem_pthread.dylibstart_wqthread thread #18 frame #0: 0x00000001f3d72050 libsystem_kernel.dylibworkq_kernreturn + 8 thread #19 frame #0: 0x00000002041d3b90 libsystem_pthread.dylibstart_wqthread thread #20 frame #0: 0x00000001f3d72050 libsystem_kernel.dylibworkq_kernreturn + 8 thread #21 frame #0: 0x00000001f3d72050 libsystem_kernel.dylib__workq_kernreturn + 8 thread #22, name = 'com.apple.coremedia.rootQueue.47' frame #0: 0x00000001f3d71adc libsystem_kernel.dylibsemaphore_timedwait_trap + 8 frame #1: 0x00000001041ce804 libdispatch.dylib_dispatch_sema4_timedwait + 64 frame #2: 0x00000001041cee04 libdispatch.dylib_dispatch_semaphore_wait_slow + 76 frame #3: 0x00000001041e2240 libdispatch.dylib_dispatch_worker_thread + 360 frame #4: 0x00000002041d46cc libsystem_pthread.dylib_pthread_start + 148 thread #23, name = 'com.apple.coremedia.rootQueue.47' frame #0: 0x00000001f3d71adc libsystem_kernel.dylibsemaphore_timedwait_trap + 8 frame #1: 0x00000001041ce804 libdispatch.dylib_dispatch_sema4_timedwait + 64 frame #2: 0x00000001041cee04 libdispatch.dylib_dispatch_semaphore_wait_slow + 76 frame #3: 0x00000001041e2240 libdispatch.dylib_dispatch_worker_thread + 360 frame #4: 0x00000002041d46cc libsystem_pthread.dylib`_pthread_start + 148 thread #24 frame #0: 0x0000000000000000

IGitGotIt commented 1 year ago

Trying to reproduce , using the token you have above I get an "invalid token format". Can you send me the api key, session id and token separately to my email. Also you can send me the token meta data you are embedding in the token , when you create it.

Thanks jaideep.shah@vonge.com

aleksandar-kalanj-interprefy commented 1 year ago

Trying to reproduce , using the token you have above I get an "invalid token format". Can you send me the api key, session id and token separately to my email. Also you can send me the token meta data you are embedding in the token , when you create it.

Thanks jaideep.shah@vonge.com

@IGitGotIt We just realized today there is a typo in the provided email address vonge.com instead of vonage.com. The email was resent to jaideep.shah@vonage.com

IGitGotIt commented 1 year ago

Trying to reproduce , using the token you have above I get an "invalid token format". Can you send me the api key, session id and token separately to my email. Also you can send me the token meta data you are embedding in the token , when you create it. Thanks jaideep.shah@vonge.com

@IGitGotIt We just realized today there is a typo in the provided email address vonge.com instead of vonage.com. The email was resent to jaideep.shah@vonage.com

I tried our Basic App (https://github.com/opentok/opentok-ios-sdk-samples/tree/main/Basic-Video-Chat or swift one https://github.com/opentok/opentok-ios-sdk-samples-swift/tree/main/Basic-Video-Chat) with the credential you send me using 2.22.0 and 2.24.2 on a simulator (intel) and a device . Both worked ok w/o any token crash (2.22.0 has a background capture warning - which can be neglected for our tests). Can you try the Basic app with those versions and lmk.

Thanks