MediaPlayer crash on iOS 7.1 (MPAVItem) - objective-c

I'm using a UIWebview to play YouTube video on my iOS app, after iOS 7.1 release, I got lots of following crash report:
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 1
Thread 0:
0 libobjc.A.dylib 0x393dd637 objc_msgSend + 23
1 Foundation 0x2f563d57 +[NSConcreteNotification newTempNotificationWithName:object:userInfo:] + 119
2 Foundation 0x2f563ca9 -[NSNotificationCenter postNotificationName:object:userInfo:] + 45
3 Foundation 0x2f5685c3 -[NSNotificationCenter postNotificationName:object:] + 27
4 MediaPlayer 0x2feb17b9 __53-[MPAVItem _playerItemNewAccessLogEntryNotification:]_block_invoke + 69
5 libdispatch.dylib 0x398bcd51 _dispatch_call_block_and_release + 9
6 libdispatch.dylib 0x398bcd3d _dispatch_client_callout + 21
7 libdispatch.dylib 0x398bf6bf _dispatch_main_queue_callback_4CF + 275
8 CoreFoundation 0x2ec0d675 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 5
9 CoreFoundation 0x2ec0bf41 __CFRunLoopRun + 1305
10 CoreFoundation 0x2eb767a5 CFRunLoopRunSpecific + 521
11 CoreFoundation 0x2eb76587 CFRunLoopRunInMode + 103
12 GraphicsServices 0x33ad36cf GSEventRunModal + 135
13 UIKit 0x314d588d UIApplicationMain + 1133
14 myApp 0x000eb679 0xe7000 + 18041
15 myApp 0x000eb5c4 0xe7000 + 17860
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x39975804 kevent64 + 24
1 libdispatch.dylib 0x398c4051 _dispatch_mgr_invoke + 229
2 libdispatch.dylib 0x398be2df _dispatch_mgr_thread + 35
Maybe the OS is trying to post a notification to an object that doesn't exist anymore. I didn't use MBAVItem directly, so it should be called while UIWebview is playing YouTube video. According iTunes connect, this crash just happened on iOS 7.1 (at least for now) and become the most frequent crash.

I used to create new YouTube HTML player for each song, and this crash happens after playing 5 - 10 songs.
After doing some experiments, this crash can be avoided by loading different songs with same YouTube HTML player (don't create a new one, just call loadVideoById()), hope this answer can help someone =)

Related

Appcelerator - iOS - KrollObject forgetKeylessKrollObject

Recently we have received a crash on one of our application with the following stack trace:
0 libobjc.A.dylib 0x00000001806c1bd0 objc_msgSend + 12
1 CoreFoundation 0x0000000180f72d90 -[NSInvocation retainArguments] + 208
2 Foundation 0x00000001819e86b4 -[NSInvocationOperation initWithInvocation:] + 72
3 Foundation 0x00000001819e85c8 -[NSInvocationOperation initWithTarget:selector:object:] + 216
4 MyApp 0x0000000100054500 -[KrollObject forgetKeylessKrollObject:] (KrollObject.m:1079)
5 MyApp 0x00000001000a1cac -[TiProxy forgetProxy:] (TiProxy.m:725)
6 MyApp 0x000000010005b070 -[TiViewProxy remove:] (TiViewProxy.m:261)
7 MyApp 0x00000001000ba294 __TiThreadPerformOnMainThread_block_invoke (TiBase.m:270)
8 MyApp 0x00000001000ba570 TiThreadProcessPendingMainThreadBlocks (TiBase.m:367)
9 libdispatch.dylib 0x0000000180a95630 _dispatch_call_block_and_release + 20
10 libdispatch.dylib 0x0000000180a955f0 _dispatch_client_callout + 12
11 libdispatch.dylib 0x0000000180a9acf8 _dispatch_main_queue_callback_4CF + 1840
12 CoreFoundation 0x0000000180ff8bb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
13 CoreFoundation 0x0000000180ff6a18 __CFRunLoopRun + 1624
14 CoreFoundation 0x0000000180f25680 CFRunLoopRunSpecific + 380
15 GraphicsServices 0x0000000182434088 GSEventRunModal + 176
16 UIKit 0x0000000185d9cd90 UIApplicationMain + 200
17 MyApp 0x000000010003c584 main (main.m:37)
Dashboard suggests that the crash has happened at forgetKeylessKrollObjject method. From the stack trace it seems that during a view removal, this indicent happened. There are many places in the code where we have added and removed view. As there is no definite place defined in the log and nor we have the test case, we went through the framework code and saw that there is no null handling inside the method as TiProxy.m --> krollObjectForBridge function can return nil.
If anyone from the community has received such report and been able to resolve it. Please do let us know as there is no way to map this stack trace back to the JavaScript code.
SDK: 3.5.0.GA
OS: iOS 9.1

Cryptic stacktrace crashing in objc_object::release()

I'm analyzing the following stack traces in Crashlytics. I'm unable to reproduce the issue on my phones. Below are the crashed thread. The stack traces are slightly different between 64 and 32 bit CPUs.
The only interesting piece of information is that there is another thread resizing an image in the background (there is no UI manipulation involved).
Since resizing the image could put some pressure on the phone's memory, I suspect this is a memory-related error, but I wouldn't expect to see a stack trace in that case and I also don't see any memory warning in the logs. Does that make sense? Or should I look for something completely different? Any suggestion would be helpful.
Would you have any suggestion about what could be happening there?
On iPhone 5S, iPad Air, the crash thread is as follow:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000001e256bec8
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x000000018f65a984 objc_object::release() + 8
1 libsystem_blocks.dylib 0x000000018fc5f908 _Block_release + 256
2 libdispatch.dylib 0x000000018fc17fd4 _dispatch_client_callout + 16
3 libdispatch.dylib 0x000000018fc1b1dc _dispatch_main_queue_callback_4CF + 336
4 CoreFoundation 0x00000001830f6ddc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
5 CoreFoundation 0x00000001830f511c __CFRunLoopRun + 1452
6 CoreFoundation 0x0000000183035dd0 CFRunLoopRunSpecific + 452
7 GraphicsServices 0x0000000188d1dc0c GSEventRunModal + 168
While executing in a high priority thread:
Thread : com.apple.root.high-priority
0 CoreGraphics 0x00000001831cef88 resample_byte_h_4cpp_armv7 + 420
1 CoreGraphics 0x00000001831cec74 resample_band + 1188
2 CoreGraphics 0x00000001831cd9b0 img_interpolate_read + 816
3 CoreGraphics 0x00000001831c94cc img_data_lock + 4440
4 CoreGraphics 0x00000001831c7944 CGSImageDataLock + 148
5 libRIP.A.dylib 0x0000000183573dec ripc_AcquireImage + 160
6 libRIP.A.dylib 0x0000000183573460 ripc_DrawImage + 624
7 CoreGraphics 0x00000001831c7674 CGContextDrawImage + 408
8 My App 0x00000001005105a4 -[UIImage(Async) scaleWithMaxSize:quality:scale:] (UIImage+Async.m:50)
9 My App 0x0000000100144244 __38-[ViewController viewDidAppear:]_block_invoke (ViewController.m:79)
10 libdispatch.dylib 0x000000018fc18014 _dispatch_call_block_and_release + 24
11 libdispatch.dylib 0x000000018fc17fd4 _dispatch_client_callout + 16
12 libdispatch.dylib 0x000000018fc1f2b8 _dispatch_root_queue_drain + 556
13 libdispatch.dylib 0x000000018fc1f4fc _dispatch_worker_thread2 + 76
14 libsystem_pthread.dylib 0x000000018fdad6bc _pthread_wqthread + 356
On iPhone 5, 4S, 4, it's slightly different
Crashed: com.apple.root.default-priority
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x2146c7cf
Thread : Crashed: com.apple.root.default-priority
0 libobjc.A.dylib 0x382af66a objc_release + 9
1 libsystem_blocks.dylib 0x387caac5 _Block_release + 216
2 libsystem_blocks.dylib 0x387caac5 _Block_release + 216
3 libxpc.dylib 0x388d9e71 _xpc_connection_call_reply + 32
4 libdispatch.dylib 0x3878fad7 _dispatch_root_queue_drain + 222
5 libdispatch.dylib 0x3878fd29 _dispatch_worker_thread2 + 56
6 libsystem_pthread.dylib 0x388cabd3 _pthread_wqthread + 298
also while executing in a high priority thread:
Thread : com.apple.root.high-priority
0 CoreGraphics 0x2d6749e6 resample_byte_h_4cpp_armv7 + 117
1 ??? 0x00000002
2 CoreGraphics 0x2d67487d resample_band + 884
3 CoreGraphics 0x2d673a47 img_interpolate_read + 562
4 CoreGraphics 0x2d6701d3 img_data_lock + 4514
5 CoreGraphics 0x2d66e82d CGSImageDataLock + 88
6 libRIP.A.dylib 0x2d9bae67 ripc_AcquireImage + 98
7 libRIP.A.dylib 0x2d9ba20d ripc_DrawImage + 588
8 CoreGraphics 0x2d66e743 CGContextDelegateDrawImage + 50
9 CoreGraphics 0x2d66e5d9 CGContextDrawImage + 284
10 My App 0x0050f469 -[UIImage(Async) scaleWithMaxSize:quality:scale:] (UIImage+Async.m:50)
11 My App 0x00153fc7 __38-[ViewController viewDidAppear:]_block_invoke (ViewController.m:79)
12 libdispatch.dylib 0x38788833 _dispatch_call_block_and_release + 10
13 libdispatch.dylib 0x3878fad7 _dispatch_root_queue_drain + 222
14 libdispatch.dylib 0x3878fd29 _dispatch_worker_thread2 + 56
15 libsystem_pthread.dylib 0x388cabd3 _pthread_wqthread + 298

Random iOS 6 crash with iOS 7 SDK

My current main Application is randomly crashing on iOS 6 devices when i compile with iOS 7. It is system deep i think and don't know how to fix this little nasty bug. In my App there are plenty of iOS 6 user with this crash and it's driving me nuts.
Thread : Fatal Exception: NSGenericException
0 CoreFoundation 0x32b902a3 __exceptionPreprocess + 162
1 libobjc.A.dylib 0x3a8b897f objc_exception_throw + 30
2 CoreFoundation 0x32b8fd85 -[NSException name]
3 UIKit 0x34d22f75 __54+[_UIAppearance _recordersExcludingSource:withWindow:]_block_invoke_0 + 332
4 CoreFoundation 0x32b8d62f __NSDictionaryEnumerate + 714
5 UIKit 0x34d22e1d +[_UIAppearance _recordersExcludingSource:withWindow:] + 136
6 UIKit 0x34e013a5 UIViewServiceCurrentAppearanceSerializedRepresentations + 60
7 UIKit 0x34d8f7c7 -[_UIRemoteViewControllerConnectionRequest _sendServiceViewControllerRequest] + 206
8 UIKit 0x34d8f65d __block_global_5 + 264
9 libdispatch.dylib 0x3acd39f7 _dispatch_barrier_sync_f_invoke + 30
10 UIKit 0x34d8f551 __76-[_UIRemoteViewControllerConnectionRequest _connectToViewControllerOperator]_block_invoke_0 + 92
11 UIKit 0x34d98bc5 __block_global_0 + 32
12 libdispatch.dylib 0x3acd53f7 dispatch_once_f$VARIANT$mp + 42
13 UIKit 0x34d98ba1 __73-[_UIViewServiceSessionEndpoint connectToDeputyOfType:connectionHandler:]_block_invoke_0 + 88
14 libdispatch.dylib 0x3acd011f _dispatch_call_block_and_release + 10
15 libdispatch.dylib 0x3acd3ecf _dispatch_queue_drain$VARIANT$mp + 142
16 libdispatch.dylib 0x3acd3dc1 _dispatch_queue_invoke$VARIANT$mp + 40
17 libdispatch.dylib 0x3acd491d _dispatch_root_queue_drain + 184
18 libdispatch.dylib 0x3acd4ac1 _dispatch_worker_thread2 + 84
19 libsystem_c.dylib 0x3ad04a11 _pthread_wqthread + 360
20 libsystem_c.dylib 0x3ad048a4 start_wqthread + 8
Add a Exception breakpoint you will get some more info about your crash.. for adding a Exception Breakpoint have a look on this https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html
Add breakpoints step into every line of code to find the bug , Or maybe this would help you read crash reports. http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs

iOS5 - KERN_INVALID_ADDRESS in crash log

I need your help to understand what's going on in this crash log for my app on iPhone 4S.
Date/Time: 2011-10-23 07:51:33.669 -0700
OS Version: iPhone OS 5.0 (9A334)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xc0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3205afbc objc_msgSend + 16
1 UIKit 0x31a19b68 -[UIAnimator stopAnimation:] + 412
2 UIKit 0x31a195d4 -[UIAnimator(Static) _advance:withTimestamp:] + 260
3 UIKit 0x31a194c6 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 46
4 QuartzCore 0x3166441c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long)+ 160
5 QuartzCore 0x31664372 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 54
6 IOMobileFramebuffer 0x32c58f8c IOMobileFramebufferVsyncNotifyFunc + 76
7 IOKit 0x34ea188a IODispatchCalloutFromCFMessage + 182
8 CoreFoundation 0x36cb9f3c __CFMachPortPerform + 356
9 CoreFoundation 0x36cc454c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
10 CoreFoundation 0x36cc44ee __CFRunLoopDoSource1 + 134
11 CoreFoundation 0x36cc333c __CFRunLoopRun + 1364
12 CoreFoundation 0x36c464d6 CFRunLoopRunSpecific + 294
13 CoreFoundation 0x36c4639e CFRunLoopRunInMode + 98
14 GraphicsServices 0x32921fe6 GSEventRunModal + 150
15 UIKit 0x318f673c UIApplicationMain + 1084
16 MyAppPro 0x0000214a main (main.m:13)
17 MyAppPro 0x00002108 start + 32
This link to a discussion in Developer Forums seems to imply bad hardware!?
A little confused!
Thanks.
Your question is a dupe of many other questions that involve EXC_BAD_ACCESS crashes.
Like this one:
how to understand Crash Log of iPhone
Why not step through your program and see if you can isolate where the crash is triggered?
The article you linked is talking about a Macintosh error with Safari, totally different than what you are experiencing.

Debugging an iPad device crash with little info

I'm getting the following stack trace from an iPad crash pulled from the device. This was pulled from a user's iPad and I don't know what they were doing when it crashed. How would I get more info on why/where the app is crashing and fix it?
Uncaught C++ Exception
Stack trace:
0 - 0 MyApp 0x00005ac1 _Z16TerminateHandlerv + 24
1 - 1 libstdc++.6.dylib 0x33814e3d _ZN10__cxxabiv111__terminateEPFvvE + 52
2 - 2 libstdc++.6.dylib 0x33814e91 _ZSt9terminatev + 16
3 - 3 libstdc++.6.dylib 0x33814f61 __cxa_throw + 84
4 - 4 libobjc.A.dylib 0x3441dc8b objc_exception_throw + 70
5 - 5 Foundation 0x3645192b __NSThreadPerformPerform + 654
6 - 6 CoreFoundation 0x34e16a79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
7 - 7 CoreFoundation 0x34e1875f __CFRunLoopDoSources0 + 382
8 - 8 CoreFoundation 0x34e194eb __CFRunLoopRun + 230
9 - 9 CoreFoundation 0x34da9ec3 CFRunLoopRunSpecific + 230
10 - 10 CoreFoundation 0x34da9dcb CFRunLoopRunInMode + 58
11 - 11 GraphicsServices 0x339d041f GSEventRunModal + 114
12 - 12 GraphicsServices 0x339d04cb GSEventRun + 62
13 - 13 UIKit 0x33a07d69 -[UIApplication _run] + 404
14 - 14 UIKit 0x33a05807 UIApplicationMain + 670
15 - 15 MyApp 0x000036af main + 70
16 - 16 MyApp 0x00003664 start + 40
Two things you might try:
Somtimes apps crash and the debugger stops on a completely different method. Enable "guard malloc" in the xcode run settings (under schemes in xcode4), run the app in the debugger utill it crashes, and see if that shows you which method is to blame.
If not, your best bet is to run the app in the debugger and make the crash happen. Try everything, simulate memory warnings everywhere, use every feature of the app, try every possible combination of paths through the app. Asking the user what they think they were doing might narrow it down some.