【问题标题】:Requests delayed up to 1min sometimes in iOS9 nsurlstoraged - NSURLStorageURLCacheDB deleteAllResponses database locked在 iOS9 nsurlstoraged 中,请求有时会延迟长达 1 分钟 - NSURLStorageURLCacheDB deleteAllResponses 数据库已锁定
【发布时间】:2015-10-06 03:21:25
【问题描述】:

自 iOS 9 以来,我们一直在重现应用程序处理返回请求时的这些巨大延迟/应用程序启动正常,查看控制器和所有内容。我能够与应用程序交互,但在某些情况下它不会加载所有请求中的一些。它只发生在 iOS9 设备中(不管它是针对 iOS8 还是 iOS9 构建的)。

我们拥有的唯一线索是每次发生这种情况时都会重复此日志:

Oct 2 15:21:15 Hurts-iPhone ondemandd[1364] <Error>: -[ODRBackgroundMaintenance startBackgroundMaintenanceOperations]
Oct 2 15:21:20 Hurts-iPhone nsurlstoraged[107] <Warning>: ERROR: NSURLStorageURLCacheDB deleteAllResponses: dbConnection=0x188dd200 DB=/private/var/mobile/Containers/Data/Application/5CD0BB06-3EF9-4A76-B5AF-25C86A8FA2AC/Library/Caches/com.company.bundleId/Cache.db Delete from cfurl_cache_blob_data failed:database is locked ErrCode: 5.
Oct 2 15:21:31 Hurts-iPhone nsurlstoraged[107] <Warning>: ERROR: NSURLStorageURLCacheDB deleteAllResponses: dbConnection=0x188dd200 DB=/private/var/mobile/Containers/Data/Application/5CD0BB06-3EF9-4A76-B5AF-25C86A8FA2AC/Library/Caches/com.company.bundleId/Cache.db Delete from cfurl_cache_receiver_data failed:database is locked ErrCode: 5.
Oct 2 15:21:31 Hurts-iPhone nsurlstoraged[107] <Error>: Error: execSQLStatement:onConnection:toCompletionWithRetry:writeLockHelp - SQL=COMMIT;, error-code=1, error-message=cannot commit - no transaction is active
Oct 2 15:21:31 Hurts-iPhone nsurlstoraged[107] <Warning>: ERROR: NSURLStorageURLCacheDB deleteAllResponses: dbConnection=0x188dd200 DB=/private/var/mobile/Containers/Data/Application/5CD0BB06-3EF9-4A76-B5AF-25C86A8FA2AC/Library/Caches/com.company.bundleId/Cache.db Commit transaction failed:cannot commit - no transaction is active ErrCode: 1.
Oct 2 15:21:34 Hurts-iPhone kernel[0] <Notice>: IOAccessoryManager::configureAllowedFeatures: tristar: revoking mask=0xffff
Oct 2 15:21:34 Hurts-iPhone iaptransportd[29] <Warning>: CIapPortAppleIDBus: Auth timer timeout completed on pAIDBPort:0x17d4a4e0, portID:01 downstream port
Oct 2 15:21:41 Hurts-iPhone nsurlstoraged[107] <Warning>: ERROR: NSURLStorageURLCacheDB deleteAllResponses: dbConnection=0x188dd200 DB=/private/var/mobile/Containers/Data/Application/5CD0BB06-3EF9-4A76-B5AF-25C86A8FA2AC/Library/Caches/com.company.bundleId/Cache.db Vacuum failed:database is locked ErrCode: 5

我见过的唯一具有相同行为的案例是在 Mac OS X 中并使用本机应用程序(邮件、iTunes 等),这使得它更加奇怪。

延迟请求似乎可以缓解这些情况。这绝对是 iOS 上的一个僵局,但我们很想走这条路。

【问题讨论】:

    标签: ios deadlock ios9 nsurl nsurlcache


    【解决方案1】:

    我也遇到了同样的问题。但在这种情况下,我的应用程序因消息应用程序而崩溃 - 'UIKitApplication:com.companyname.com[0xrhel]' 被 jetsam 杀死。

    【讨论】:

    • 你找到解决办法了吗?
    【解决方案2】:

    我终于找到了一个解决方案,从一开始就从应用程序中删除缓存。我们不会大量使用应用程序缓存,因此在我们的例子中,它在性能方面并不是一个昂贵的解决方案。移除缓存的方法是在应用启动时设置一个空缓存

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:0
                                                         diskCapacity:0
                                                             diskPath:nil];
    [NSURLCache setSharedURLCache:URLCache];
    

    我希望这对其他人有帮助。

    与此同时,Apple 方面有一些未解决的错误报告。当我得到更多关于它的信息时,我会在这里发布。

    【讨论】:

      【解决方案3】:

      我删除了cache.db,好像没问题


      我认为这不是一个好的解决方案,但它确实有效。

      【讨论】:

        猜你喜欢
        • 2021-07-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-05-11
        相关资源
        最近更新 更多