[Webkit-unassigned] [Bug 172983] Weird isMainThread() ASSERT on local iOS build

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 6 09:55:22 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=172983

--- Comment #2 from David Kilzer (:ddkilzer) <ddkilzer at webkit.org> ---
This does look like the isMainThread() assertion is firing on the main thread:

    frame #51: 0x000000010b76402f UIKit`-[UIApplication _run] + 468
    frame #52: 0x000000010b76a0d4 UIKit`UIApplicationMain + 159
    frame #53: 0x00000001004fe8ff NYTimes`main at main.swift:52
    frame #54: 0x000000011241965d libdyld.dylib`start + 1
    frame #55: 0x000000011241965d libdyld.dylib`start + 1

There are two ways this could happen that I can think of:

1. The initialization code for setting up isMainThread() hasn't been run yet.
2. The initialization code for setting up isMainThread() ran on the wrong thread.

Note that the initialization code is all in initializeMainThreadPlatform() and initializeMainThreadToProcessMainThread() in Source/WTF/wtf/mac/MainThreadMac.mm--which is used on Cocoa platforms and should be moved and renamed--and in Source/WTF/wtf/MainThread.cpp.

Since you're subclassing UIWebView and this is happening at startup, you also need to be aware that UIKit.framework has soft-linked Web[Core|Kit].framework for a few releases now, and only initializes the soft links on-demand via +[UIWebView initialize].  I suspect (just a guess) that if you call +[UIWebView initialize] from +[AsyncWebView initialize] that it might do the right thing for you (since AsyncWebView is probably getting loaded before UIWebView).

Note that if you choose to ignore this issue (not saying you would, but for other Internet denizens who might read this), you will likely see (a potentially long tail of) crashes that you can't explain, or look like threading issues, but you have no idea why they're happening.

The other best way to do avoid this mess is to use WKWebView (WebKit2), so I'd be interested in what prevents you from using it instead of UIWebView.  (We can take that offline if you'd like.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170606/0a86f655/attachment.html>


More information about the webkit-unassigned mailing list