26

I have an iOS application built using a UIWebView and HTML5 websockets. The app experiences seemingly random crashes. It has occurred while a user is interacting with it and during longevity tests where no interaction between user and app occurs.

The crash logs all have the following:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000

and the thread logs contain:

Thread XX name:  WebCore: Worker
Thread XX Crashed:
0   WebCore                         0x36c8c7a0 WebCore::UserGestureIndicator::processingUserGesture() + 20
1   WebCore                         0x36d7070a WebCore::DOMTimer::DOMTimer(WebCore::ScriptExecutionContext*, WTF::PassOwnPtr<WebCore::ScheduledAction>, int, bool) + 74
2   WebCore                         0x36d70616 WebCore::DOMTimer::install(WebCore::ScriptExecutionContext*, WTF::PassOwnPtr<WebCore::ScheduledAction>, int, bool) + 46
3   WebCore                         0x3753ae7e WebCore::WorkerContext::setTimeout(WTF::PassOwnPtr<WebCore::ScheduledAction>, int) + 30
4   WebCore                         0x3731ac02 WebCore::JSWorkerContext::setTimeout(JSC::ExecState*) + 194
5   WebCore                         0x37318ff6 WebCore::jsWorkerContextPrototypeFunctionSetTimeout(JSC::ExecState*) + 110
6   JavaScriptCore                  0x2fa9a1d8 llint_native_call_trampoline + 62
7   JavaScriptCore                  0x2faa355a JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 66
8   WebCore                         0x36db0b16 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 558
9   WebCore                         0x36d6ebba WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow>&) + 482
10  WebCore                         0x36c6da2a WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 174
11  WebCore                         0x36e28824 WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) + 60
12  WebCore                         0x3753e596 WebCore::MessageWorkerContextTask::performTask(WebCore::ScriptExecutionContext*) + 222
13  WebCore                         0x3753ec6e WebCore::WorkerRunLoop::runInMode(WebCore::WorkerContext*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 158
14  WebCore                         0x3753eb94 WebCore::WorkerRunLoop::run(WebCore::WorkerContext*) + 60
15  WebCore                         0x37540d64 WebCore::WorkerThread::workerThread() + 432
16  JavaScriptCore                  0x2fa4ba68 WTF::wtfThreadEntryPoint(void*) + 12
17  libsystem_pthread.dylib         0x397b6c5a _pthread_body + 138
18  libsystem_pthread.dylib         0x397b6bca _pthread_start + 98
19  libsystem_pthread.dylib         0x397b4ccc thread_start + 4

I managed to catch the exception on throw, and from what I can tell it looks to be a framework bug. See attached screenshot.

enter image description here

Most of what I've read seem to indicate that the web view is being dealloced prior to a delegate firing, but nowhere in my code do I dealloc!

Has anyone encountered this or a similar case? Any help is much appreciated!

UPDATE

I have filed a bug report with Apple after contacting developer support. Their engineers confirmed this as being a bug.

  • 1
    If after your research and others help here you are unable to resolve the issue, I encourage you to file a bug report with Apple at http://bugreport.apple.com/ – Anil Dec 31 '13 at 20:21
  • @SlyRaskal: Agreed. Will do so if nothing comes of this post! –  Dec 31 '13 at 20:23
  • 2
    I'm having a similar issue with an exception coming from the WebCore worker thread. Have you tried running a Zombie profiler to check if/where an invalid object is being accessed? – user2085001 Dec 31 '13 at 22:14
  • @user2085001: I tried running both Zombies and Leaks from Instruments. Neither showed anything out of the ordinary. Thanks for the suggestion. –  Jan 03 '14 at 21:58
  • 2
    If there will be any progress on issue from bug tracking on Apple's side (I don't expect anywhere in many months though), please do update this topic with answer regarding this issue. As well this question can be sort of closed as can't be solved, but is good to keep open as some people might have similar and so wont ask same question. – moka Mar 06 '14 at 17:18

1 Answers1

1

In My Case, I have similar issue.

WebView Crash

As Many of said, it may cause due to WebView Delegate methods are calling while webview is being deallocated.

In order to fix, we need to set delegate as nil and also stop webview request at specified methods

You have to add below lines of code

-(void)viewDidUnload{
    [super viewDidUnload];

    webViewRef.delegate = nil;
    [webViewRef stopLoading];

}

-(void)backBtnClicked{

    webViewRef.delegate = nil;
    [webViewRef stopLoading];

}

Hope it helps you.

Vidhyanand
  • 5,369
  • 4
  • 26
  • 59