申请未能及时恢复 [英] Application failed to resume in time

查看:109
本文介绍了申请未能及时恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个非常具体的场景中遇到了未能及时恢复崩溃(我认为它与看门狗有关):只有在从后台恢复时,并且只有在去往后很短的时间内才能恢复背景(最多几秒钟)。

I encounter a "failed to resume in time" crash (which I assume to be watchdog related) on a very specific scenario: Only when resuming from background, and only when doing it within a really short amount of time after going to background (a few seconds at most).

这似乎是相关的崩溃日志:

This seems to be the relevant crash log:

Incident Identifier: E30F2238-5B15-49A1-BCBC-386791AC93FA
CrashReporter Key:   84f4fb61c9e5c597750146695fffdc55f7273fb7
Hardware Model:      iPod4,1
Process:         XXXXXXX
Path:            /var/mobile/Applications/DE774CCE-D452-418D-A862-4562A0E5F1D0/XXXXXXX.app/XXXXXXX
Identifier:      XXXXXXX
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2013-01-14 13:15:41.955 +0200
OS Version:      iOS 6.0 (10A403)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread:  0

Application Specific Information:
XXXXXXX failed to resume in time

Elapsed total CPU time (seconds): 9.140 (user 9.140, system 0.000), 91% CPU 
Elapsed application CPU time (seconds): 7.806, 78% CPU

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x336fa7cc fsync + 8
1   Foundation                      0x3a444974 _NSWriteBytesToFileWithExtendedAttributes + 668
2   Foundation                      0x3a4446ce _NSWriteBytesToFile + 22
3   Foundation                      0x3a4446ac -[NSData(NSData) writeToFile:atomically:] + 80
4   XXXXXX                          0x001777ee 0xe3000 + 608238
5   CoreFoundation                  0x38361034 _CFXNotificationPost + 1424
6   Foundation                      0x3a437d8c -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
7   Foundation                      0x3a43b84e -[NSNotificationCenter postNotificationName:object:] + 26
8   XXXXXX                          0x000e6616 0xe3000 + 13846
9   UIKit                           0x37e050e4 -[UIApplication _handleApplicationSuspend:eventInfo:] + 780
10  UIKit                           0x37d7b1ea -[UIApplication handleEvent:withNewEvent:] + 2454
11  UIKit                           0x37d7a6d0 -[UIApplication sendEvent:] + 68
12  UIKit                           0x37d7a11e _UIApplicationHandleEvent + 6150
13  GraphicsServices                0x3600d5a0 _PurpleEventCallback + 588
14  GraphicsServices                0x3600d1ce PurpleEventCallback + 30
15  CoreFoundation                  0x383e5170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
16  CoreFoundation                  0x383e5112 __CFRunLoopDoSource1 + 134
17  CoreFoundation                  0x383e3f94 __CFRunLoopRun + 1380
18  CoreFoundation                  0x38356eb8 CFRunLoopRunSpecific + 352
19  CoreFoundation                  0x38356d44 CFRunLoopRunInMode + 100
20  GraphicsServices                0x3600c2e6 GSEventRunModal + 70
21  UIKit                           0x37dce2fc UIApplicationMain + 1116
22  XXXXXXX                         0x000e5cd0 0xe3000 + 11472
23  XXXXXXX                         0x000e5c6c 0xe3000 + 11372

我已经尝试过调试这个,但是当连接到调试器时似乎没有发生(并且我发现的所有相关信息都表明wacthdog在连接时被禁用)调试器),然后我尝试记录该过程,尝试并按照发生的事情。

I've tried debugging this, but it doesn't seem to happen when connected to a debugger (and all relevant info I've found on the matter suggest wacthdog is disabled when connected to debugger), so I then tried logging the process to try and follow what goes on.

我已将记录添加到所有 AppDelegate 相关方法( applicationWillResignActive applicationDidEnterBackground applicationWillEnterForeground applicationDidBecomeActive 和甚至 applicationWillTerminate )但是从后台返回时没有记录,只有在转到后台时才会记录。据我所知,某些进程可以以一种方式调度,即使应用程序在后台运行指定的时间内也可以恢复,但我不会自己执行任何此类进程。也许Facebook SDK做了类似的事情,但我也找不到任何引用,崩溃日志也没有提供任何指示。

I've added logging to all the AppDelegate relevant methods (applicationWillResignActive, applicationDidEnterBackground, applicationWillEnterForeground, applicationDidBecomeActive and even applicationWillTerminate) but got no logs when returning from the background, only when going to background. I understand that some processes can be dispatched in a way that enables them to resume even when the app is in the background for a specified amount of time, but I do not execute any such processes on my own. Perhaps the Facebook SDK does something like that, but I could not find any reference to that either, and the crash logs provide no indication.

我在这里有点不知所措,并且会欣赏任何推动甚至推动正确的方向。

I'm a little at a loss here, and would appreciate any push or even nudge in the right direction.

推荐答案

是的,这与看门狗有关。

Yes, this is watchdog related.

是否有可能您的写入过程在主线程上花费了太多时间并阻止了那个?这可以解释为什么在从后台返回时没有显示日志数据,而这只会在转到后台后很快恢复时发生。

Is it possible that your writing process takes too much time on the main thread and is blocking that one? That would explain why no log data is shown when coming back from background and that this only happens when resuming very shortly after going to background.

我建议您执行以下操作:

I would recommend doing the following:


  1. 在进入后台而不是主线程时编写数据,
    但是通过以下方式使用后台任务:

  1. Writing your data when going into background not in the main thread, but using a background task via:

[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^ {...

最大的规则:永远不要阻止主线程,可能需要更长的时间不到一秒钟。将所有内容移动到后台线程中或在此场景中移动到后台任务中。

Biggest rule: never block the main thread with anything might take longer than a fraction of a second. Move that all into background threads or in this scenario into a background task.

这篇关于申请未能及时恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆