无法重现的 webcore 崩溃 [英] Unreproducible webcore crashes

查看:28
本文介绍了无法重现的 webcore 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 iPad 应用程序在 App Store 上架了大约三个月,我收到了一些我无法弄清楚的奇怪崩溃报告.这些并不是那么频繁,自发布以来大约有 15-20 个实例,但仍然频繁到足以真正让我烦恼.崩溃略有不同(请参阅下面的堆栈跟踪),但由于它们与 WebCore 相关,我猜它们与应用程序中 UIWebView 的使用有关可能有一个共同的原因,尽管我不是 100% 肯定的.该应用程序的部署目标是 iOS 6.0,但崩溃出现在 iPad 2、iPad 3 和 iPad Mini 上,仅在 iOS 7 上.

I've got an iPad app that's in the App Store for around three months now and I've been receiving some weird crash reports that I can't figure out. These are not that frequent, got around 15-20 instances since the launch but still frequent enough to actually bug me. The crashes are slightly different (see stack traces below) but since they are related to WebCore I'm guessing they have to do with the usage of the UIWebView in the app and might have a common cause, though I'm not 100% positive. The deployment target of the app is iOS 6.0 but crashes appear on iPad 2, iPad 3 and iPad Mini, exclusively on iOS 7.

我在应用程序中只有一个地方使用了 webview,用于显示来自各种来源的新闻文章网页.我有一个视图控制器,它有一个 UIWebView 作为它的视图.这个视图控制器的一个实例存在于整个应用程序中,每次选择一篇新文章时,现有的 webview 都会使用新选择的文章的 url 重新加载.

There is only one place in the app where I'm using a webview, for displaying news article web pages from various sources. I have one view controller for this that has a UIWebView as its view. There is one instance of this view controller that lives throughout the app, each time a new article is selected the existing webview reloads with the url of the newly selected article.

基于围绕 WebCore 问题的讨论提出的解决方案之一建议在控制器的 dealloc 方法中将 webviews delegate 属性设置为 nil.不幸的是,我认为它不适用于我的情况,因为视图控制器在应用程序的生命周期内不会被释放.
另一个问题可能是不正确的网页在 CSS 中有错误的图像引用(loadPendingImages 崩溃).不过我还没有找到这样的页面.
另外,我仔细检查并确保在主线程上进行了与 webview 相关的操作.

One of the proposed solutions based on the discussion around WebCore issues suggested setting the webviews delegate property to nil in the controller's dealloc method. Unfortunately I don't think it's applicable in my case because the view controller does not get deallocated during the lifecycle of the app.
Another issue might be incorrect webpages that have bad image references in the CSS (loadPendingImages crash). I couldn't find such a page yet though.
Also, I double-checked and made sure to do webview-related operations on the main thread.

崩溃是

Exception Type: EXC_BAD_ACCESS 
Code: KERN_INVALID_ADDRESS

带有以下堆栈跟踪(完整的这里)

with the following stack traces (full ones here)

0 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 815
1 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 788
2 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 948
3 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 96
4 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142
5 WebCore WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const + 458

0 WebCore WebCore::StyleResolver::loadPendingImages() + 1153
1 WebCore WebCore::ResourceRequestBase::~ResourceRequestBase() + 104
2 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 782
3 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 948
4 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 96
5 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142

0 WebCore WebCore::StyleResolver::adjustRenderStyle(WebCore::RenderStyle*, WebCore::RenderStyle*, WebCore::Element*) + 19
1 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 964
2 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 96
3 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142
4 WebCore WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const + 458
5 WebCore WebCore::CSSComputedStyleDeclaration::getPropertyValue(WebCore::CSSPropertyID) const + 42

0 WebCore WebCore::TimerBase::heapDeleteMin() + 37
1 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 94
2 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 94
3 WebCore WebCore::timerFired(__CFRunLoopTimer*, void*) + 24
4 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
5 CoreFoundation __CFRunLoopDoTimer + 782

有没有人遇到过类似的崩溃?如果是这样:
1.有没有办法复制它们?
2.如何在不复制的情况下调试它们?
3. 哪些修复解决了这些问题?

Has anyone experienced similar crashes? If so:
1. Are there ways to replicate them?
2. How can one debug these without replicating them?
3. What fixes solved the issues?

谢谢!

推荐答案

我在开发的应用程序中遇到了完全相同的问题,奇怪的是它只发生在运行 iOS 7 的旧设备上.我怀疑这与他们有关跟不上.

I had exactly the same issue in an app I worked on, it weirdly only occurred on older devices running iOS 7. I suspect this has something to do with them not being able to keep up.

我拥有的是一个 UITableView,其中一行将打开一个 UIViewController,上面有一个 UIWebView 用于自定义广告.我发现在较旧的设备上,对象和内存的释放频率比我在其他平台上看到的要频繁得多.通过进出屏幕 2 或 3 次,我可以很容易地在 iPhone 4 上模拟崩溃.作为 iPhone 5,我花了 15 分钟来做同样的事情,而且无可挑剔.

What I had was a UITableView where one of the rows would open a UIViewController that had a UIWebView on it for custom adverts. What I found is that on the older devices objects and memory where being free'd up far more regularly than I'd seen in other platforms. I could mimic the crash very easily on an iPhone 4 by going in / out of the screen 2 or 3 times. Where as an iPhone 5 I spent 15 minutes doing the same and couldn't fault it.

我知道您可能会觉得您的控制器没有被释放,但听起来好像是或者某些引用正在被删除,我还看到我的委托引用在这个应用程序中也消失了几次.

I know you may feel like your controller is not being dealloc'd but it really sounds as though it is or some reference is being dropped, I have also seen my delegate references disappear a few times in this app also.

我的建议和对我有用的是停止 webview 的执行,并尽可能将所有内容设置为 nil.

My advice and what worked for me is to stop the execution of the webview and set everything to nil when you can.

在我的应用程序的一个实例中,我选择在 viewWillDisappear 回调中执行此操作,因为在我的情况下,它已从用户那里消失并稍后重新创建,因此我将所有内容都这样删除:

In one instance on my app I chose to do it on the viewWillDisappear callback, because in my circumstance it was gone from the user and recreated later, so I blanked everything like so:

[webView stopLoading];

self.webView.delegate = nil;
self.webView = nil;

这篇关于无法重现的 webcore 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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