UIWebView вызывая сторожевой тайм-аут?
У нас есть довольно простое нативное приложение для iOS, которое почти готово для отправки на утверждение, за исключением одной досадной ошибки. То есть в редких случаях (когда системная память не хватает? И замечена только на iPad (3,1)) при возобновлении работы приложения оно зависает на 10 секунд, а затем вылетает.
Приложение в основном представляет собой UIWebView с облегченной оболочкой для управления некоторыми значениями ключей iCloud. Мы используем нативную аналитику Google, содержание нашего веб-представления использует манифест кэша и локальное хранилище.
Мы можем воспроизвести ошибку только после того, как намеренно забили системное приложение Safari (открыв много крупных сайтов), пока переключение между вкладками не заставит safari начать обновлять каждую страницу (как будто Safari / iOS решила, что для освобождения памяти она собирается очистить содержимое уже открытых вкладок). Поскольку наше приложение в основном представляет собой просто WebView, мы задаемся вопросом, выводит ли система наш контент. Если бы это было все, что случилось, это было бы хорошо... но вместо этого он зависает и падает.
Мы знаем, что 8badf00d / не удалось возобновить вовремя... но мы просто не знаем, что его вызвало.
Я разместил наш журнал аварий ниже. Заранее спасибо за помощь!
Incident Identifier: 956DBEA0-ECA4-4E16-91F7-573A7AD7D44C
CrashReporter Key: 0d3d958fa8005603bcc173d27ae567507d0cbb19
Hardware Model: iPad3,1
Process: REDACTED [12885]
Path: /var/mobile/Applications/REDACTED/REDACTED.app/REDACTED
Identifier: REDACTED
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-08-25 15:28:14.138 -0400
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.REDACTED.REDACTED failed to resume in time
Elapsed total CPU time (seconds): 18.710 (user 18.710, system 0.000), 93% CPU
Elapsed application CPU time (seconds): 9.513, 47% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libRIP.A.dylib 0x32d9ee8c convolve_buffer + 108
1 libRIP.A.dylib 0x32d99fa0 separable_convolve + 704
2 libRIP.A.dylib 0x32d8f35e symmetric_convolve + 414
3 libRIP.A.dylib 0x32d8f052 RIPLayerSymmetricConvolve + 554
4 libRIP.A.dylib 0x32d8eda0 RIPLayerGaussianBlur + 464
5 libRIP.A.dylib 0x32d9184a rips_s_BltShapeShadow + 458
6 libRIP.A.dylib 0x32d9944e rips_s_BltShape + 94
7 libRIP.A.dylib 0x32d897a0 ripc_Render + 248
8 libRIP.A.dylib 0x32d8b722 ripc_DrawPath + 338
9 CoreGraphics 0x32a6b4bc CGContextDrawPath + 144
10 WebCore 0x38a53246 WebCore::GraphicsContext::fillPath(WebCore::Path const&) + 558
11 WebCore 0x38b19518 WebCore::GraphicsContext::fillRectWithRoundedHole(WebCore::IntRect const&, WebCore::RoundedRect const&, WebCore::Color const&, WebCore::ColorSpace) + 396
12 WebCore 0x389836ec WebCore::RenderBoxModelObject::paintBoxShadow(WebCore::PaintInfo const&, WebCore::IntRect const&, WebCore::RenderStyle const*, WebCore::ShadowStyle, bool, bool) + 1644
13 WebCore 0x38982ba0 WebCore::RenderBox::paintBoxDecorations(WebCore::PaintInfo&, WebCore::IntPoint const&) + 348
14 WebCore 0x3898152a WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::IntPoint const&) + 58
15 WebCore 0x389828f4 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::IntPoint const&) + 168
16 WebCore 0x38980126 WebCore::RenderLayer::paintLayerContents(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::IntRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int) + 1086
17 WebCore 0x3897fcc6 WebCore::RenderLayer::paintLayer(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::IntRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int) + 1078
18 WebCore 0x38980552 WebCore::RenderLayer::paintLayerContents(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::IntRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int) + 2154
19 WebCore 0x38aab67e WebCore::RenderLayerBacking::paintIntoLayer(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::IntRect const&, unsigned int, unsigned int, WebCore::RenderObject*) + 150
20 WebCore 0x38aab4fa WebCore::RenderLayerBacking::paintContents(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, unsigned int, WebCore::IntRect const&) + 158
21 WebCore 0x38aab452 WebCore::GraphicsLayer::paintGraphicsLayerContents(WebCore::GraphicsContext&, WebCore::IntRect const&) + 94
22 WebCore 0x38aab37c __drawLayerContents_block_invoke_0 + 180
23 WebKit 0x39240e14 WKCALayerEnumerateRectsBeingDrawnWithBlock + 56
24 WebCore 0x38aaaf5c drawLayerContents(CGContext*, CALayer*, WebCore::PlatformCALayer*) + 520
25 QuartzCore 0x3457c1ae CABackingStoreUpdate_ + 1806
26 QuartzCore 0x3457b910 CA::Layer::display_() + 976
27 WebCore 0x38aaad02 -[WebLayer display] + 50
28 QuartzCore 0x34572936 CA::Layer::display_if_needed(CA::Transaction*) + 198
29 QuartzCore 0x34572860 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 20
30 QuartzCore 0x3457223e CA::Context::commit_transaction(CA::Transaction*) + 234
31 QuartzCore 0x3457204c CA::Transaction::commit() + 312
32 UIKit 0x3496d13e _UIWindowUpdateVisibleContextOrder + 206
33 UIKit 0x3496d00e +[UIWindow _prepareWindowsForAppResume] + 6
34 UIKit 0x3496cae8 -[UIApplication _handleApplicationResumeEvent:] + 72
35 UIKit 0x347c4d54 -[UIApplication handleEvent:withNewEvent:] + 1288
36 UIKit 0x347c46c8 -[UIApplication sendEvent:] + 68
37 UIKit 0x347c4116 _UIApplicationHandleEvent + 6150
38 GraphicsServices 0x364b85a0 _PurpleEventCallback + 588
39 CoreFoundation 0x32991680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
40 CoreFoundation 0x32990ee4 __CFRunLoopDoSources0 + 208
41 CoreFoundation 0x3298fcb2 __CFRunLoopRun + 642
42 CoreFoundation 0x32902eb8 CFRunLoopRunSpecific + 352
43 CoreFoundation 0x32902d44 CFRunLoopRunInMode + 100
44 GraphicsServices 0x364b72e6 GSEventRunModal + 70
45 UIKit 0x348182fc UIApplicationMain + 1116
46 REDACTED 0x00087828 main (main.m:16)
47 libdyld.dylib 0x3ac89b1c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3ad40648 kevent64 + 24
1 libdispatch.dylib 0x3ac70974 _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x3ac70654 _dispatch_mgr_thread$VARIANT$mp + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3ad500fc __psynch_mutexwait + 24
1 libsystem_c.dylib 0x3ac99124 pthread_mutex_lock + 388
2 WebCore 0x388f4418 _ZL17_WebTryThreadLockb + 184
3 WebCore 0x388f434a _ZL14WebRunLoopLockP19__CFRunLoopObservermPv + 42
4 CoreFoundation 0x329916ca __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
5 CoreFoundation 0x3298f9bc __CFRunLoopDoObservers + 272
6 CoreFoundation 0x3298fde8 __CFRunLoopRun + 952
7 CoreFoundation 0x32902eb8 CFRunLoopRunSpecific + 352
8 CoreFoundation 0x32902d44 CFRunLoopRunInMode + 100
9 WebCore 0x388f2500 _ZL12RunWebThreadPv + 440
10 libsystem_c.dylib 0x3aca930e _pthread_start + 306
11 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 3 name: com.crashlytics.MachExceptionServer
Thread 3:
0 libsystem_kernel.dylib 0x3ad3feb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3ad40048 mach_msg + 36
2 REDACTED 0x000ab1a4 CLSMachExceptionServer + 116
3 libsystem_c.dylib 0x3aca930e _pthread_start + 306
4 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 4 name: JavaScriptCore::BlockFree
Thread 4:
0 libsystem_kernel.dylib 0x3ad5008c __psynch_cvwait + 24
1 libsystem_c.dylib 0x3aca1d2a _pthread_cond_wait + 642
2 libsystem_c.dylib 0x3aca1aa0 pthread_cond_timedwait + 40
3 JavaScriptCore 0x368adc70 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 104
4 JavaScriptCore 0x369bf552 JSC::BlockAllocator::blockFreeingThreadMain() + 78
5 JavaScriptCore 0x369d1fa8 _ZN3WTFL19wtfThreadEntryPointEPv + 12
6 libsystem_c.dylib 0x3aca930e _pthread_start + 306
7 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 5 name: JavaScriptCore::Marking
Thread 5:
0 libsystem_kernel.dylib 0x3ad5008c __psynch_cvwait + 24
1 libsystem_c.dylib 0x3aca1d2a _pthread_cond_wait + 642
2 libsystem_c.dylib 0x3acabf14 pthread_cond_wait + 36
3 JavaScriptCore 0x36952f3c JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode) + 144
4 JavaScriptCore 0x36952e7c JSC::MarkStackThreadSharedData::markingThreadMain() + 140
5 JavaScriptCore 0x369d1fa8 _ZN3WTFL19wtfThreadEntryPointEPv + 12
6 libsystem_c.dylib 0x3aca930e _pthread_start + 306
7 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 6 name: com.apple.NSURLConnectionLoader
Thread 6:
0 libsystem_kernel.dylib 0x3ad3feb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3ad40048 mach_msg + 36
2 CoreFoundation 0x32991040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x3298fd9e __CFRunLoopRun + 878
4 CoreFoundation 0x32902eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x32902d44 CFRunLoopRunInMode + 100
6 Foundation 0x3324f3d0 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x332d2e80 __NSThread__main__ + 968
8 libsystem_c.dylib 0x3aca930e _pthread_start + 306
9 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 7 name: WebCore: CFNetwork Loader
Thread 7:
0 libsystem_kernel.dylib 0x3ad3feb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3ad40048 mach_msg + 36
2 CoreFoundation 0x32991040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x3298fd9e __CFRunLoopRun + 878
4 CoreFoundation 0x32902eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x32902d44 CFRunLoopRunInMode + 100
6 WebCore 0x3898cd02 _ZN7WebCoreL15runLoaderThreadEPv + 138
7 JavaScriptCore 0x369d1fa8 _ZN3WTFL19wtfThreadEntryPointEPv + 12
8 libsystem_c.dylib 0x3aca930e _pthread_start + 306
9 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 8 name: com.apple.CFSocket.private
Thread 8:
0 libsystem_kernel.dylib 0x3ad50594 __select + 20
1 CoreFoundation 0x329951f2 __CFSocketManager + 674
2 libsystem_c.dylib 0x3aca930e _pthread_start + 306
3 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 9 name: WebCore: LocalStorage
Thread 9:
0 libsystem_kernel.dylib 0x3ad5008c __psynch_cvwait + 24
1 libsystem_c.dylib 0x3aca1d2a _pthread_cond_wait + 642
2 libsystem_c.dylib 0x3acabf14 pthread_cond_wait + 36
3 JavaScriptCore 0x368adc42 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 58
4 WebCore 0x38b06e88 WTF::PassOwnPtr<WebCore::StorageTask> WTF::MessageQueue<WebCore::StorageTask>::waitForMessageFilteredWithTimeout<bool ()(WebCore::StorageTask*)>(WTF::MessageQueueWaitResult&, bool (&)(WebCore::StorageTask*), double) + 52
5 WebCore 0x38b06e3c WebCore::StorageThread::threadEntryPoint() + 120
6 JavaScriptCore 0x369d1fa8 _ZN3WTFL19wtfThreadEntryPointEPv + 12
7 libsystem_c.dylib 0x3aca930e _pthread_start + 306
8 libsystem_c.dylib 0x3aca91d4 thread_start + 4
Thread 10:
0 libsystem_kernel.dylib 0x3ad50d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3ac9ecf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3ac9ea12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3ac9e8a0 start_wqthread + 4
Unknown thread crashed with unknown flavor: 5, state_count: 1
РЕДАКТИРОВАТЬ: Добавление наших функций AppDelegate.m:
//
// AppDelegate.m
// REDACTED
//
// Created by REDACTED on 5/8/13.
// Copyright (c) 2013 REDACTED. All rights reserved.
//
#import "AppDelegate.h"
#import "QSNavigationBar.h"
#import "QSUtils.h"
#import "QSInAppPurchaseHelper.h"
#import "GAI.h"
#import "Reachability.h"
#import <Crashlytics/Crashlytics.h>
@interface AppDelegate ()
@property (nonatomic, strong) Reachability* internetReach;
@end
@implementation AppDelegate
@synthesize internetReach = _internetReach;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// customize appearance
[QSInAppPurchaseHelper sharedInstance];
// plist used to populate user defaults
NSString* path = [[NSBundle mainBundle] pathForResource:@"REDACTED" ofType:@"plist"];
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile:path];
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
self.internetReach = [Reachability reachabilityForInternetConnection];
[self.internetReach startNotifier];
[self setReachabilityStatus:self.internetReach];
// Optional: automatically send uncaught exceptions to Google Analytics.
[GAI sharedInstance].trackUncaughtExceptions = YES;
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 20;
// Optional: set debug to YES for extra debugging information.
[GAI sharedInstance].debug = NO;
// Create tracker instance.
id<GAITracker> tracker;
tracker = [[GAI sharedInstance] trackerWithTrackingId:@"REDACTED"];
// register to observe notifications from the icloud store
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(storeDidChange:) name: NSUbiquitousKeyValueStoreDidChangeExternallyNotification object: [NSUbiquitousKeyValueStore defaultStore]];
// get changes that might have happened while this
// instance of your app wasn't running
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
[self customizeAppearance];
[Crashlytics startWithAPIKey:@"REDACTED"];
return YES;
}
- (void)storeDidChange:(NSNotification *)notification
{
[QSUtils resolve];
[[NSNotificationCenter defaultCenter] postNotificationName:@"iCloudChange" object:nil];
}
- (void)customizeAppearance
{
[[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
[[UINavigationBar appearance] setBackgroundColor:[QSUtils colorFromHex:@"#333333"]];
}
- (void)reachabilityChanged:(NSNotification*)note
{
NSLog(@"!!!Reachability Changed!!!");
Reachability* curReach = [note object];
NSParameterAssert([curReach isKindOfClass:[Reachability class]]);
[self setReachabilityStatus:curReach];
[[NSNotificationCenter defaultCenter] postNotificationName:@"reachabilityChanged" object:nil];
}
- (void)setReachabilityStatus:(Reachability*)curReach
{
NetworkStatus netStatus = [curReach currentReachabilityStatus];
switch (netStatus) {
case NotReachable: {
[QSUtils setHasInternetConnection:NO];
break;
}
case ReachableViaWWAN:
case ReachableViaWiFi: {
[QSUtils setHasInternetConnection:YES];
break;
}
}
}
@end