AVAudioEngineImpl::IOUnitConfigurationChanged() Crash - ios

I use AudioEngine.
In crash reports I see some random EXC_BREAKPOINT crashes with this stacktrace
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001896df0e4
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [12467]
Triggered by Thread: 15
Thread 15 Crashed:
0 libdispatch.dylib 0x00000001896df0e4 __DISPATCH_WAIT_FOR_QUEUE__ + 448 (queue.c:1619)
1 libdispatch.dylib 0x00000001896dec74 _dispatch_sync_f_slow + 140 (queue.c:1732)
2 libdispatch.dylib 0x00000001896dec74 _dispatch_sync_f_slow + 140 (queue.c:1732)
3 AVFAudio 0x00000001965b11a8 -[AVAudioEngine dealloc] + 308 (AVAudioEngine.mm:406)
4 Foundation 0x0000000189ce52ac -[NSConcreteNotification dealloc] + 68 (NSNotification.m:206)
5 AVFAudio 0x00000001965b7158 invocation function for block in AVAudioEngineImpl::IOUnitConfigurationChanged() + 292 (AVAudioEngine.mm:1215)
6 libdispatch.dylib 0x00000001896de998 _dispatch_block_async_invoke2 + 104 (queue.c:525)
7 libdispatch.dylib 0x00000001896fb184 _dispatch_client_callout + 16 (object.m:495)
8 libdispatch.dylib 0x00000001896d4e8c _dispatch_continuation_pop$VARIANT$armv81 + 404 (inline_internal.h:2484)
9 libdispatch.dylib 0x00000001896e502c _dispatch_source_invoke$VARIANT$armv81 + 1232 (source.c:568)
10 libdispatch.dylib 0x00000001896d85e0 _dispatch_lane_serial_drain$VARIANT$armv81 + 260 (inline_internal.h:2525)
11 libdispatch.dylib 0x00000001896d9128 _dispatch_lane_invoke$VARIANT$armv81 + 400 (queue.c:3863)
12 libdispatch.dylib 0x00000001896e243c _dispatch_workloop_worker_thread + 576 (queue.c:6445)
13 libsystem_pthread.dylib 0x000000018974ab88 _pthread_wqthread + 276 (pthread.c:2351)
14 libsystem_pthread.dylib 0x000000018974d760 start_wqthread + 8
I can't reproduce this crash and stacktrace doesn't point to my code. Does anyone know what is cause of this crash, how this can be fixed and if it's even possible to fix?
Thanks

According to the apple documentation of AVAudioEngineConfigurationChange,
You must not release the engine during handling this notification.
Note The engine must not be deallocated from within the client's
notification handler. Callback happens on an internal dispatch queue
and can deadlock while trying to teardown the engine synchronously.
Though you didn't release at that time, It can be caused.
AVAudioEngine in iOS 11 or 12 can be stucked to notify before, then you release engine later.
There's workaround. You have to re-use the audio engine rather than re-create.

Related

Crash on NotificationCenter addObserver call

I'm new to this project and Firebase has been added only recently, so I've some issue to figure out the reason of a crash (that I can't reproduce locally).
It's a EXC_BAD_ACCESS KERN_INVALID_ADDRESS on dispatch_call_block_and_release.
Therefore it should be a memory issue, trying to access to an object that has been already deallocated.
The last traced line is an addObserver call of Notification Center, and then the call trace continue with several calls but not showing an exact line of code. Since I don't see anything wrong with that observer, I'm wondering: is this line significant? Or it could be that the app is crashing on a different thread so that the call trace is irrelevant?
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000008
Crashed: com.apple.main-thread
0 MyPod 0x103dafb18 (Missing)
1 MyPod 0x103daf564 (Missing)
2 MyPod 0x103daf9fc (Missing)
3 MyApp 0x103b12ffc (Missing)
4 MyPod 0x103daf268 (Missing)
5 MyPod 0x103dae844 (Missing)
6 MyPod 0x103daef64 (Missing)
7 MyPodClient 0x103d40fd0 (Missing)
8 MyPodClient 0x103d3dcb8 (Missing)
9 libdispatch.dylib 0x1a9e38610 _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x1a9e39184 _dispatch_client_callout + 16
11 libdispatch.dylib 0x1a9deb190 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1044
12 CoreFoundation 0x1aa0ea5e4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13 CoreFoundation 0x1aa0e55d8 __CFRunLoopRun + 2004
14 CoreFoundation 0x1aa0e4adc CFRunLoopRunSpecific + 464
15 GraphicsServices 0x1b406a328 GSEventRunModal + 104
16 UIKitCore 0x1ae1dfae0 UIApplicationMain + 1936
17 MyApp 0x102e0bce0 main + 21 (PlayerPlugin.swift:21) //-> This is the line in which a func is called, and inside this func observers are added.
thanks
ps. I don't know if this helps, but for some crash reports (but not all of them), I get in the KEYS section this line:
crash_info_entry_0
CoreUI: deallocating _CUIInternalLinkRendition 7113 /private/var/containers/Bundle/Application/A6721767-C6DD-43AB-B2E0-094D4CBD12D6/MyApp.app/Assets.car
Is this related to assets? However it looks more like a consequence of the crash, rather than a cause.

NSLogger in iOS freeze my app

I am integrate NSLogger into my iOS app, I found that after integrate NSLogger, My app become easy to freeze, especially when there is no internet.
I added code below to main.m, anyone know why?
Logger *logger = LoggerGetDefaultLogger();
LoggerSetOptions(logger,
kLoggerOption_BufferLogsUntilConnection |
kLoggerOption_CaptureSystemConsole |
kLoggerOption_BrowseBonjour |
kLoggerOption_BrowseOnlyLocalDomain);
LoggerSetupBonjour(logger, NULL, NULL));
this is crash log:
Incident Identifier: 5278EF6A-1128-49D6-B31A-B6AA03AC856C
CrashReporter Key: 848d8e4999dd36db808023480dc660a86c173fee
Hardware Model: iPad6,7
Process: My App [386]
Path: /private/var/containers/Bundle/Application/579502B0-20F3-4C83-82F0-ED50BC79C831/My App.app/My App
Identifier: com.xiang.My App
Version: 1140 (1.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.xiang.My App [490]
Date/Time: 2016-11-18 13:41:18.1326 +0900
Launch Time: 2016-11-18 13:33:07.3810 +0900
OS Version: iPhone OS 10.1.1 (14B100)
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018e8d9948 writev + 8
1 CoreFoundation 0x000000018f909cc0 _CFLogvEx2Predicate + 452
2 CoreFoundation 0x000000018f909eec _CFLogvEx3 + 408
3 Foundation 0x00000001903f0454 _NSLogv + 132
4 Foundation 0x000000019031735c NSLog + 32
5 My App 0x00000001000511a4 0x100030000 + 135588
6 My App 0x0000000100050f2c 0x100030000 + 134956
7 My App 0x000000010008b18c 0x100030000 + 373132
8 My App 0x0000000100089530 0x100030000 + 365872
9 UIKit 0x00000001958a7dc0 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 728
10 UIKit 0x0000000195958b34 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 268
11 UIKit 0x0000000195a0bd5c _runAfterCACommitDeferredBlocks + 292
12 UIKit 0x00000001959fdb10 _cleanUpAfterCAFlushAndRunDeferredBlocks + 560
13 UIKit 0x000000019576c854 _afterCACommitHandler + 168
14 CoreFoundation 0x000000018f8d37dc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
15 CoreFoundation 0x000000018f8d140c __CFRunLoopDoObservers + 372
16 CoreFoundation 0x000000018f8d189c __CFRunLoopRun + 1024
17 CoreFoundation 0x000000018f800048 CFRunLoopRunSpecific + 444
18 GraphicsServices 0x0000000191286198 GSEventRunModal + 180
19 UIKit 0x00000001957e52fc -[UIApplication _run] + 684
20 UIKit 0x00000001957e0034 UIApplicationMain + 208
21 GroundStation Pro 0x00000001000f27b0 0x100030000 + 796592
22 libdyld.dylib 0x000000018e7e45b8 start + 4
Firstly you should not be adding code to main.m. Look into placing code like this in your application delegate.
Secondly, the 0x8badf00d crash is a known error caused by your application taking too long to start. This may be because you have the log start code in the wrong location as I've said above. Or it may be something else.
As a general rule, anything you have in the startup of your application take may take time, should be either delayed or placed on a back ground thread. Application startup should get the user to the home screen of your app as soon as possible.

FMDB Crash: SEGV_MAPERR at [FMDatabaseQueue inDatabase:]

I'm using FMDB in an iOS app. Recently I have received several crash reports from Apteligent about a crash of FMDB:
0 libdispatch.dylib 0x00000001810ab120 _dispatch_main_queue_callback_4CF + 2904
! 1 myApp 0x00000001001ac840 -[FMDatabaseQueue inDatabase:] (FMDatabaseQueue.m:142)
2 myApp 0x000000010011844c +[DataBaseController insert:withObjects:] (DataBaseController.m:602)
3 myApp 0x0000000100118254 +[DataBaseController insertObjects:withObjects:] (DataBaseController.m:575)
4 myApp 0x0000000100150e80 -[SendManagementBBDD crearySalvarEnvioConSolicitud:EntidadParaEncolar:borrarTrasEnvio:] (SendManagementBBDD.m:686)
5 myApp 0x0000000100150a28 __76-[SendManagementBBDD sendEntitiesAfterDetail:OnComplete:]_block_invoke (SendManagementBBDD.m:615)
6 libdispatch.dylib 0x00000001810a55f0 _dispatch_client_callout + 12
7 libdispatch.dylib 0x00000001810b0b94 _dispatch_sync_f_invoke + 68
8 myApp 0x0000000100150404 -[SendManagementBBDD sendEntitiesAfterDetail:OnComplete:] (SendManagementBBDD.m:563)
9 myApp 0x000000010005c284 __44-[DetailVC startWork:]_block_invoke (DetailVC.m:286)
10 libdispatch.dylib 0x00000001810a5630 _dispatch_call_block_and_release + 20
11 libdispatch.dylib 0x00000001810a55f0 _dispatch_client_callout + 12
12 libdispatch.dylib 0x00000001810b3a88 _dispatch_root_queue_drain + 2136
13 libdispatch.dylib 0x00000001810b3224 _dispatch_worker_thread3 + 108
14 libsystem_pthread.dylib 0x00000001812b9470 _pthread_wqthread + 1088
15 libsystem_pthread.dylib 0x00000001812b9020 start_wqthread + 0
I access to the database from multiple threads. As the documentation says, I have a single instance of FMDatabaseQueue and I share it across all the threads of the app. I'm getting a SEGV_MAPERR crash at the method [FMDatabaseQueue inDatabase:]
This crash happens hardly ever, but I would like to resolve it.
Any ideas what is causing it?
Thank you very much.
Like your other question, this crash seems to be a part of your app code and not Crittercism SDK. If you still believe that this has been caused due to Crittercism, you can create a support ticket by sending an email to support#apteligent.com by mentioning the concerned App ID and the direct crash URL. Be noted that the email support is available for paid customers only.

Swift - “EXC_BREAKPOINT (SIGTRAP)” Crash

I have released my app few months ago and I have more than 2000 users registered. I have had no crashes expect for one user that is saying that the app is crashing all the time on his device (iPhone 6). He was so kind to send me the crash report but I cannot find the solution to his bug or reproduce the bug at all. I told him to try to reset his iPhone but this did not solve the issue the app still crashing.
How could I debug this crash log and see where the error is happening? (EXC_BREAKPOINT (SIGTRAP))
the crash report says:
Date/Time: 2016-03-27 16:02:15.15 +0200
Launch Time: 2016-03-27 16:02:13.13 +0200
OS Version: iOS 9.2.1 (13D15)
Report Version: 105
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 My App 0x0011d140 0x1f000 + 1040704
1 My App 0x0013e0d8 0x1f000 + 1175768
2 My App 0x0013c208 0x1f000 + 1167880
3 UIKit 0x2a6aa64e 0x2a622000 + 558670
4 UIKit 0x2a8d3032 0x2a622000 + 2822194
5 UIKit 0x2a8d6f0e 0x2a622000 + 2838286
6 UIKit 0x2a8eac14 0x2a622000 + 2919444
7 UIKit 0x2a8d43f6 0x2a622000 + 2827254
8 FrontBoardServices 0x277afc74 0x2778b000 + 150644
9 FrontBoardServices 0x277aff60 0x2778b000 + 151392
10 CoreFoundation 0x26461256 0x263a9000 + 754262
11 CoreFoundation 0x26460e46 0x263a9000 + 753222
12 CoreFoundation 0x2645f1ae 0x263a9000 + 745902
13 CoreFoundation 0x263b1bb8 0x263a9000 + 35768
14 CoreFoundation 0x263b19ac 0x263a9000 + 35244
15 UIKit 0x2a6a3a16 0x2a622000 + 530966
16 UIKit 0x2a69dfb4 0x2a622000 + 507828
17 My App 0x0013d8ec 0x1f000 + 1173740
18 libdyld.dylib 0x26064872 0x26062000 + 10354

com.apple.NSURLSession-work EXC_BAD_ACCESS Crash debugging

I'm seeing the following crash report, but it's not reproducible. How would I go about debugging it? Is this an AFNetworking issue? I'm using version 2.4.1.
Crashed: com.apple.NSURLSession-work
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000000
Thread : Crashed: com.apple.NSURLSession-work
0 CoreFoundation 0x0000000184aad978 CFDictionaryGetValue + 56
1 Foundation 0x0000000185aa9300 _NSSetLongLongValueAndNotify + 72
2 Foundation 0x0000000185aa9300 _NSSetLongLongValueAndNotify + 72
3 CFNetwork 0x0000000184543468 -[__NSCFLocalSessionTask _task_onqueue_didFinish] + 472
4 CFNetwork 0x0000000184544b38 -[__NSCFLocalSessionTask connection:didFinishLoadingWithError:] + 40
5 CFNetwork 0x000000018458d030 __46-[__NSCFURLSessionConnection _task_sendFinish]_block_invoke + 136
6 libdispatch.dylib 0x0000000196a49994 _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x0000000196a49954 _dispatch_client_callout + 16
8 libdispatch.dylib 0x0000000196a540a4 _dispatch_queue_drain + 1448
9 libdispatch.dylib 0x0000000196a4ca5c _dispatch_queue_invoke + 132
10 libdispatch.dylib 0x0000000196a56318 _dispatch_root_queue_drain + 720
11 libdispatch.dylib 0x0000000196a57c4c _dispatch_worker_thread3 + 108
12 libsystem_pthread.dylib 0x0000000196c2922c _pthread_wqthread + 816
Yes, it's probably an AFNetworking bug (fixed in 2.5.0), in all likelihood. Specifically, this one:
https://github.com/AFNetworking/AFNetworking/issues/1477
If not, then it is probably something similar—a key-value observer trying to observe some aspect of a URL session task has been deallocated and didn't stop observing that task prior to being deallocated.
I got the same issue and I found it is because I was using Firebase SDK and I upgraded it to 7.0.0,(Although this issue is reported by many developers from > 6.32.1 to 7.0.0) So the firebasePerformance is causing this issue in the first place, which later caused a crash while downloading images using SDWebImage. More information about this issue is here:
firebase/firebase-ios-sdk#6734
Firebase recently fixed this and released a new version for FirebasePerformance (7.0.1) After upgrading to version 7.0.1, I wasn't able to reproduce the crash any longer.
So upgrading of FirebasePerformance SDK to 7.0.1 version worked for me.

Resources