Summary: | ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap() | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Daniel Bates <dbates> | ||||||||
Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | achristensen, andersca, beidson, cdumez, commit-queue, david_quesada, ews-watchlist, ggaren, rniwa, sam, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Mac | ||||||||||
OS: | OS X 10.11 | ||||||||||
Attachments: |
|
Description
Daniel Bates
2015-12-21 10:01:57 PST
Created attachment 267753 [details]
Unit test
Unit test that demonstrates the bug. Apply the patch and run:
Tools/Scripts/run-api-tests --debug _WKDownload.CrashAfterDownloadDidFinishWhenDownloadProxyHoldsTheLastRefOnWebProcessPool
Then TestWebKitAPI will crash due to the assertion failure.
As can be implied from examining _WKDownload.CrashAfterDownloadDidFinishWhenDownloadProxyHoldsTheLastRefOnWebProcessPool or downloadTest() (invoked by tests ContentFiltering.{Allow, Block}DownloadAfterWillSendRequest) the DownloadProxy object associated with the started download holds the last ref to the WebProcessPool that created it. The driver code in these tests released the reference to the WebProcessPool object they held when the WKWebView they created was destroyed and when the WKProcessPool object (returned by -[WKWebViewConfiguration processPool]) was destroyed when the autorelease pool was drained. Created attachment 364075 [details]
Patch
Comment on attachment 364075 [details] Patch Attachment 364075 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/11433932 New failing tests: accessibility/mac/selection-notification-focus-change.html Created attachment 364101 [details]
Archive of layout-test-results from ews106 for mac-highsierra-wk2
The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
Comment on attachment 364075 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364075&action=review > Source/WebKit/UIProcess/Downloads/DownloadProxyMap.cpp:62 > + auto protectedProcessPool = makeRefPtr(m_process->processPool()); Since the DownloadProxyMap is owned by the NetworkProcessProxy, I think it would be clearer to ref m_process here: auto protectedThis = makeRefPtr(m_process); (In reply to Chris Dumez from comment #6) > Comment on attachment 364075 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=364075&action=review > > > Source/WebKit/UIProcess/Downloads/DownloadProxyMap.cpp:62 > > + auto protectedProcessPool = makeRefPtr(m_process->processPool()); > > Since the DownloadProxyMap is owned by the NetworkProcessProxy, I think it > would be clearer to ref m_process here: > auto protectedThis = makeRefPtr(m_process); I thought about doing that at first, but the WebProcessPool has a unique_ptr to the NetworkProcessProxy, so I assumed it would be wrong to hold another reference outside of the "unique" reference. If we only ref the NetworkProcessProxy here, then the WebProcessPool would still be deallocated when invalidating the DownloadProxy, and the NetworkProcessProxy will be deallocated after a short existence without a WebProcessPool. I thought protecting the process pool would be safer, and I couldn't think of any downsides to doing so that would justify changing the process pool's unique_ptr to a Ref and ensuring the NetworkProcessProxy can outlive the WebProcessPool without any issues. (Also, the win EWS issues appear unrelated - the tests are failing with or without this patch. And the mac-wk2 failure is also unrelated - when I checked on Friday, many other unrelated patches were seeing this test fail, and it was marked as a failure in r242688) Comment on attachment 364075 [details]
Patch
Oh, I forgot that the NetworkProcessProxy is not Refcounted anymore. r=me then.
Comment on attachment 364075 [details] Patch Clearing flags on attachment: 364075 Committed r242693: <https://trac.webkit.org/changeset/242693> All reviewed patches have been landed. Closing bug. |