Bug 140470

Summary: Web pages fail to load using public iOS WebKit; ASSERT(!isMainThread()) in -[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]
Product: WebKit Reporter: Daniel Bates <dbates>
Component: Page LoadingAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, ddkilzer, psolanki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: iOS 8.1   
Attachments:
Description Flags
Backtrace
none
Patch none

Description Daniel Bates 2015-01-14 15:16:19 PST
Created attachment 244648 [details]
Backtrace

When I load apple.com in the iOS Simulator using a debug build of iOS WebKit built with the public iOS SDK the assertion ASSERT(!isMainThread()) fails in -[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:].

I'm using OpenSource r178229 and the public iOS 8.1 SDK with Xcode Version 6.1.1 (6A2008a) on OS X 10.10.1 (14B25).
Comment 1 Pratik Solanki 2015-01-14 15:28:27 PST
Does this get fixed if you comment out the following line?

    CFURLRequestSetShouldStartSynchronously(request, 1);

in ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
Comment 2 Daniel Bates 2015-01-16 16:00:09 PST
Created attachment 244815 [details]
Patch
Comment 3 Daniel Bates 2015-01-16 16:06:29 PST
(In reply to comment #1)
> Does this get fixed if you comment out the following line?
> 
>     CFURLRequestSetShouldStartSynchronously(request, 1);
> 
> in ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp

No, the issue reproduced even after commenting out the analogous line in ResourceHandleMac.mm: <http://trac.webkit.org/browser/trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm?rev=176949#L222>.
Comment 4 Daniel Bates 2015-01-16 16:10:22 PST
Pratik and I looked at this issue together today (01/16). Pratik noticed that we were incorrectly scheduling the NSURLConnection callbacks in WebKit2 with the NetworkProcess. Looking at this case, we want to schedule such callbacks to an NSOperationsQueue queue when using WebKit2 with the NetworkProcess.
Comment 5 Daniel Bates 2015-01-16 16:12:46 PST
Comment on attachment 244815 [details]
Patch

Clearing flags on attachment: 244815

Committed r178612: <http://trac.webkit.org/changeset/178612>
Comment 6 Daniel Bates 2015-01-16 16:12:50 PST
All reviewed patches have been landed.  Closing bug.