UIWebView导致看门狗超时?

时间:2013-08-29 23:16:02

标签: ios objective-c uiwebview timeout watchdog

我们有一个相当简单的原生iOS应用程序,几乎可以提交审批,除了一个讨厌的bug。那是在极少数情况下(当系统内存很低?只在iPad(3,1)上注意到)恢复应用程序时,它会挂起10秒然后崩溃。

该应用程序基本上是一个UIWebView,周围有一个轻量级shell,用于管理一些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

0 个答案:

没有答案