The issue started happening randomly after iOS 16 update. For video exporting AVFoundation's AVAssetExportSession is used. The issue happens only when AVVideoComposition's animationTool property is applied. The ui freezes when the export process finishes. Main thread's call stack is attached below.
Thread 0 - com.apple.main-thread - (TH_STATE_WAITING)
0 libsystem_kernel.dylib +0x13004 _mach_msg2_internal
1 libsystem_kernel.dylib +0x13244 _mach_msg_overwrite
2 libsystem_kernel.dylib +0x1088 _mach_msg
3 QuartzCore +0x8a6ac CA::Render::Message::send_message()
4 QuartzCore +0x2612a8 CA::Render::Encoder::send_message(unsigned int, unsigned int, unsigned int*, unsigned long)
5 QuartzCore +0x31168 CA::Context::commit_transaction(CA::Transaction*, double, double*)
6 QuartzCore +0x663c0 CA::Transaction::commit()
7 UIKitCore +0x504fcc __UIApplicationFlushCATransaction
8 UIKitCore +0x651674 __UIUpdateSequenceRun
9 UIKitCore +0xc90900 _schedulerStepScheduledMainSection
10 UIKitCore +0xc8facc _runloopSourceCallback
11 CoreFoundation +0xd6228 ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
12 CoreFoundation +0xe2610 ___CFRunLoopDoSource0
13 CoreFoundation +0x66578 ___CFRunLoopDoSources0
14 CoreFoundation +0x7beb4 ___CFRunLoopRun
15 CoreFoundation +0x811e0 _CFRunLoopRunSpecific
16 GraphicsServices +0x1364 _GSEventRunModal
17 UIKitCore +0x3a2d84 -[UIApplication _run]
18 UIKitCore +0x3a29e8 _UIApplicationMain
19 PicsArt +0x4998b0 main (main.m:29:16)
20 dyld +0x15944 start
I tried to call AVAssetExportSession's exportAsynchronously and cancelExport functions on background queue, as a result the number of crashes decreased, but big number of users still get this app hang. I expect to find some workaround solution for this.
Related
One of our users confronted us with the problem, that the App crashes directly after the app start. Now we only got two Crash Reports, but couldn't reproduce the Crash on any of our devices. The Build is an Enterprise Distribution Build.
The Device is an iPhone 4, with iOS 6.
Any idea would be much appreciated.
Date/Time: 2012-10-30 17:41:11.762 +0100
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x38edad8e memmove$VARIANT$CortexA8 + 654
1 QuartzCore 0x3401c81c CA::Render::Encoder::encode_bytes(void const*, unsigned long) + 24
2 QuartzCore 0x3401d494 CA::Render::Layer::Ext::encode(CA::Render::Encoder*) const + 152
3 QuartzCore 0x3401c706 CA::Render::encode_set_object(CA::Render::Encoder*, unsigned long, unsigned int, CA::Render::Object*, unsigned int) + 42
4 QuartzCore 0x3401b3e2 CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 114
5 QuartzCore 0x34011076 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 310
6 QuartzCore 0x3401101c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 220
7 QuartzCore 0x3401101c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 220
8 QuartzCore 0x3401052c CA::Context::commit_transaction(CA::Transaction*) + 1024
9 QuartzCore 0x34010024 CA::Transaction::commit() + 312
10 QuartzCore 0x3400fe84 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
11 CoreFoundation 0x34e326ca __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
12 CoreFoundation 0x34e309bc __CFRunLoopDoObservers + 272
13 CoreFoundation 0x34e30d12 __CFRunLoopRun + 738
14 CoreFoundation 0x34da3eb8 CFRunLoopRunSpecific + 352
15 CoreFoundation 0x34da3d44 CFRunLoopRunInMode + 100
16 GraphicsServices 0x35b0c2e6 GSEventRunModal + 70
17 UIKit 0x379e92fc UIApplicationMain + 1116
18 MyApp 0x000ceb90 main (main.m:16)
19 MyApp 0x000ceb2c start + 36
Here's the second one:
Date/Time: 2012-10-29 15:54:48.926 +0100
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x33b1beb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33b1c048 mach_msg + 36
2 CoreFoundation 0x34e32040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x34e30d5a __CFRunLoopRun + 810
4 CoreFoundation 0x34da3eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x34da3d44 CFRunLoopRunInMode + 100
6 GraphicsServices 0x35b0c2e6 GSEventRunModal + 70
7 UIKit 0x379e92fc UIApplicationMain + 1116
8 MyApp 0x00024b90 main (main.m:16)
9 MyApp 0x00024b2c start + 36
The first one I would suspect that you're animating things while they're being put onto the screen (since it happens during launch). Perhaps something UI-related you're doing in your application delegate, or otherwise doing from a view controller that isn't on the screen yet. That said, the Core Animation calls may be a red herring (see below).
The second one is unlikely the actual crash point. iOS cannot always determine which thread actually crashed, and sometimes will blame the wrong one (and most often thread 0 will be incorrectly blamed). Crashing in a _trap function is really unlikely. The thread is generally suspended at this point. I would study the other threads and see if one of them was doing something suspicious. If you find it elsewhere, then this could also be the cause of the first crash.
I don't have much information when did it happened, because it didn't happened on my watch.
Anyone understand what was the reason?
Crash Log:
OS Version: iPhone OS 5.0 (9A334)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x80624913
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x37c38fbc objc_msgSend + 16
1 UIKit 0x32bc8cec -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded] + 128
2 UIKit 0x0061d7ee -[UIScrollViewAccessibility(SafeCategory) _scrollViewAnimationEnded] + 358
3 CoreFoundation 0x309f8224 -[NSObject performSelector:withObject:] + 36
4 UIKit 0x32b84c2a -[UIAnimator stopAnimation:] + 606
5 UIKit 0x32b845d4 -[UIAnimator(Static) _advance:withTimestamp:] + 260
6 UIKit 0x32b844c6 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 46
7 QuartzCore 0x3219a41c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 160
8 QuartzCore 0x3219a372 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 54
9 IOMobileFramebuffer 0x3577ff8c IOMobileFramebufferVsyncNotifyFunc + 76
10 IOKit 0x31d2d88a IODispatchCalloutFromCFMessage + 182
11 CoreFoundation 0x30a62f3c __CFMachPortPerform + 356
12 CoreFoundation 0x30a6d54c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
13 CoreFoundation 0x30a6d4ee __CFRunLoopDoSource1 + 134
14 CoreFoundation 0x30a6c33c __CFRunLoopRun + 1364
15 CoreFoundation 0x309ef4d6 CFRunLoopRunSpecific + 294
16 CoreFoundation 0x309ef39e CFRunLoopRunInMode + 98
17 GraphicsServices 0x3361dfe6 GSEventRunModal + 150
18 UIKit 0x32a6173c UIApplicationMain + 1084
19 MyApp 0x00002304 0x1000 + 4868
20 MyApp 0x00002298 0x1000 + 4760
Looks like a segmentation fault. It seems like (just by observing the trace) there's some memory issue going on when the UIScrollView finishes a scroll animation. Have you tried enabling NSZombies or putting a breakpoint that catches any kind of exception? I know you said it didn't happen on your watch, but if you could get a brief description of where it happened, maybe you can attempt to replicate it while debugging it in Xcode.
I received the following crash report from a user.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xf0012e8d
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3601cc98 objc_msgSend + 16
1 CoreFoundation 0x312bdc30 CFGetRetainCount
2 QuartzCore 0x30605c08 CA::release_root_if_unused(_CALayer*, _CALayer*, void*)
3 QuartzCore 0x30605bb4 x_hash_table_remove_if
4 QuartzCore 0x305e4f96 CA::Transaction::commit()
5 QuartzCore 0x305de04e CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
6 CoreFoundation 0x312fca2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
7 CoreFoundation 0x312fe45e __CFRunLoopDoObservers
8 CoreFoundation 0x312ff754 __CFRunLoopRun
9 CoreFoundation 0x3128febc CFRunLoopRunSpecific
10 CoreFoundation 0x3128fdc4 CFRunLoopRunInMode
11 GraphicsServices 0x32478418 GSEventRunModal
12 GraphicsServices 0x324784c4 GSEventRun
13 UIKit 0x329f8d62 -[UIApplication _run]
14 UIKit 0x329f6800 UIApplicationMain
15 IW Select 0x00002b60 main + 44
16 IW Select 0x00002b28 start + 32
I'm having trouble debugging it since it doesn't look like the crash was even caused by something in my app. Does anyone know what could cause a crash like this?
If we observe the crash log, we will notice that, it was expecting some object but it was already released.(see it was calling CFGetRetainCount on the needed object to acertain that object is still alive, but it is not). Also, if we notice the frameworks then it indicates that crash could be because of some view is released or something related to it.(as it says its crashing during animation.)
0 libobjc.A.dylib 0x3601cc98 objc_msgSend + 16
1 CoreFoundation 0x312bdc30 CFGetRetainCount
2 QuartzCore 0x30605c08 CA::release_root_if_unused(_CALayer*, _CALayer*, void*)
3 QuartzCore 0x30605bb4 x_hash_table_remove_if
4 QuartzCore 0x305e4f96 CA::Transaction::commit()
5 QuartzCore 0x305de04e CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
6 CoreFoundation 0x312fca2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
Thanks,
This might be able to help you out or at least get you started.
Debugging EXC_BAD_ACCESS Errors
Check your localization settings. Specifically, change your language settings to something other than English/your default language and see if you can reproduce the crash.
I am trying to figure out what is causing this crash. I have built and given the app to our testers but we cannot seem to reproduce this reliably. It just happens sometimes...
Thread 0 Crashed:
0 libobjc.A.dylib 0x000027da objc_msgSend + 18
1 Foundation 0x00032896 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
2 Foundation 0x00032818 _NSURLConnectionDidFinishLoading + 72
3 CFNetwork 0x00010dd8 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 160
4 CFNetwork 0x00004ad4 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 96
5 CFNetwork 0x000049c4 URLConnectionClient::processEvents() + 64
6 CFNetwork 0x00004976 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
7 CFNetwork 0x000048f4 MultiplexerSource::perform() + 120
8 CFNetwork 0x00004872 MultiplexerSource::_perform(void*) + 2
9 CoreFoundation 0x00055f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
10 CoreFoundation 0x00027ba0 __CFRunLoopDoSources0 + 376
11 CoreFoundation 0x00027444 __CFRunLoopRun + 224
12 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
14 GraphicsServices 0x000045ec GSEventRunModal + 108
15 GraphicsServices 0x00004698 GSEventRun + 56
16 UIKit 0x0000411c -[UIApplication _run] + 396
17 UIKit 0x00002128 UIApplicationMain + 664
18 myapp 0x000020d8 main (main.m:14)
19 myapp 0x0000208c start + 32
Any advice would be greatly appreciated. The app is built in XCode 3.2.4 using SDK 4.1.
Cheers...
I would try turning on NSZombieEnabled and see if that sheds any light on the issue. Is the delegate for the connection still around and valid?
Ben has some sound advice. Turn NSZombieEnabled to on.
I can tell you with almost 100% certainty that it is crashing because you have a nil object when the delegate is attempting to send it a message.
The fact that it is only crashing sometimes, tells me that you are probably using autorelease. Autorelease never decrements the retain count at exactly the same time, so sometimes your object will still be alive when it gets a delegate message and the app works. However, sometimes that object will have been released and the app crashes.
I am working on an app that tracks a users location. After about 20 minutes it seems that the app always crashes, and I am not sure why. Device logs show:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x069f6000
Crashed Thread: 0
Thread 0 Crashed:
0 Ride 0x00012e00 -[Route addCoordinate:] (Route.m:92)
1 Ride 0x0000877a -[MyRidesMapViewController locationManager:didUpdateToLocation:fromLocation:] (MyRidesMapViewController.m:528)
2 CoreLocation 0x0000931c -[CLLocationManager onClientEventLocation:] + 584
3 CoreLocation 0x00007552 -[CLLocationManager onClientEvent:supportInfo:] + 98
4 CoreLocation 0x000076a0 OnClientEvent + 16
5 CoreLocation 0x00002ade CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
6 CoreLocation 0x0000512c CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 204
7 CoreLocation 0x0000528a CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 298
8 CoreFoundation 0x0006936a __CFMessagePortPerform + 242
9 CoreFoundation 0x00071aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
10 CoreFoundation 0x00073848 __CFRunLoopDoSource1 + 160
11 CoreFoundation 0x00074626 __CFRunLoopRun + 514
12 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
14 GraphicsServices 0x000036e8 GSEventRunModal + 108
15 GraphicsServices 0x00003794 GSEventRun + 56
16 UIKit 0x000062a0 -[UIApplication _run] + 396
17 UIKit 0x00004e10 UIApplicationMain + 664
18 Ride 0x00002a20 main (main.m:14)
19 Ride 0x000029d4 start + 32
Looks like I am trying to release something that has already been released, but what?! I have NSZombie enabled, and it does not seem to help.
It used to work, and I recently updated my class to use self. for anything that I synthesized, could this be the issue?
EDIT: I updated the error. It seems to be listing the line numbers for each line, but they do not seem to be helping to find the issue.
Do you have NSZombie enabled while you're running on the device? If so chances are you are running out of memory. As you know, NSZombie keeps released objects around so you can detect a double release.
Chances are you do have some memory issues though. Does the static analyzer show you anything? (shift-command-A).
Setting the location manager delegate to nil AND THEN releasing it fixed the crash for me.