Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoreTelephony crash (non-reproducible)

This crashes occurs only in production

Crashed Thread
0   
libobjc.A.dylib 0x000000019843fbd0 objc_msgSend + 16
1   
CoreTelephony 0x00000001886bac5c _ZL25_ServerConnectionCallbackP20__CTServerConnectionPK10__CFStringPK14__CFDictionaryPv + 48
2   
CoreTelephony 0x00000001886d1030 ___ZNK13CTServerState21sendNotification_syncE7CTEventPK10__CFStringPK14__CFDictionary_block_invoke14 + 28
3   
libdispatch.dylib 0x0000000198a713ac _dispatch_call_block_and_release + 20
4   
libdispatch.dylib 0x0000000198a7136c _dispatch_client_callout + 12
5   
libdispatch.dylib 0x0000000198a7b4c0 _dispatch_queue_drain + 1212
6   
libdispatch.dylib 0x0000000198a74474 _dispatch_queue_invoke + 128
7   
libdispatch.dylib 0x0000000198a7d224 _dispatch_root_queue_drain + 660
8   
libdispatch.dylib 0x0000000198a7e75c _dispatch_worker_thread3 + 104
9   
libsystem_pthread.dylib 0x0000000198c4d2e4 _pthread_wqthread + 812
10  
libsystem_pthread.dylib 0x0000000198c4cfa8 start_wqthread + 0

this one too

Crashed Thread
0   
libobjc.A.dylib 0x306e1f46 objc_msgSend + 6
1   
CoreTelephony 0x2291fc95 ___ZNK13CTServerState21sendNotification_syncE7CTEventPK10__CFStringPK14__CFDictionary_block_invoke14 + 14
2   
libdispatch.dylib 0x30c662e3 _dispatch_call_block_and_release + 8
3   
libdispatch.dylib 0x30c6e729 _dispatch_queue_drain + 1466
4   
libdispatch.dylib 0x30c68aad _dispatch_queue_invoke + 82
5   
libdispatch.dylib 0x30c6ff9f _dispatch_root_queue_drain + 392
6   
libdispatch.dylib 0x30c713c3 _dispatch_worker_thread3 + 92
7   
libsystem_pthread.dylib 0x30dcddc1 _pthread_wqthread + 666
8   
libsystem_pthread.dylib 0x30dcdb14 start_wqthread + 6

i am guessing from logs that these happen only some time after the device sleeps. since the timestamp between the crash and last activity log is at least 10 minutes apart. we do not use coretelophony ourselves, but some of the frameworks we use do have coretelephony as a dependency. anyone knows how to replicate this, or knows how to work around this?

like image 660
tzl Avatar asked Oct 31 '22 15:10

tzl


1 Answers

This bug occurs when CTTelephonyNetworkInfo get notifications after it is released. Instead you should use:

   static CTTelephonyNetworkInfo *netInfo; 
   static dispatch_once_t dispatchToken; 
   if (!netInfo) { 
      dispatch_once(&dispatchToken, ^{ 
         netInfo = [[CTTelephonyNetworkInfo alloc] init]; 
      }); 
   }

because, as others said:

"There is an iOS bug that causes instances of the CTTelephonyNetworkInfo class to sometimes get notifications after they have been deallocated. Instead of instantiating, using, and releasing instances you must instead retain and never release them to work around the bug."

More information here

like image 101
ares777 Avatar answered Nov 15 '22 06:11

ares777