Bug 227964

Summary: Speculative fix for failed scope.releaseAssertNoException() after calls to JSMap::create().
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, keith_miller, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch.
ews-feeder: commit-queue-
proposed patch. ysuzuki: review+

Description Mark Lam 2021-07-14 12:50:55 PDT
There have been reports of flaky failures on the scope.releaseAssertNoException() after the call to JSMap::create() in JSModuleLoader::finishCreation().

The scope.releaseAssertNoException() says that we don't expect the JSMap::create() to ever throw an exception.  If the assertion is true, the only way that we can see an exception there is if we're throwing an asynchronous TerminationException.  Since JSModuleLoader::finishCreation() does have any long running loops, we can just DeferTerminationForAWhile and let the next exception check site throw the asynchronous TerminationException.  We don't want to just use DeferTermination because it will throw the TerminationException right at the end of JSModuleLoader::finishCreation(), and the caller of JSModuleLoader::finishCreation() may be similarly not expecting an exception to be thrown there.

Also apply the same treatment to AbstractModuleRecord::finishCreation(), and getBackingMap() in WebCore for the same reason.  Other than those, other sites that call JSMap::create() already check for exceptions.  So, those sites do not need to DeferTerminationForAWhile.

rdar://78013960
Comment 1 Mark Lam 2021-07-14 12:59:12 PDT
Created attachment 433520 [details]
proposed patch.
Comment 2 Mark Lam 2021-07-14 13:03:44 PDT
Created attachment 433522 [details]
proposed patch.
Comment 3 Yusuke Suzuki 2021-07-14 13:19:58 PDT
Comment on attachment 433522 [details]
proposed patch.

r=me
Comment 4 Mark Lam 2021-07-14 15:07:04 PDT
Thanks for the review.  I'm pretty sure the jsc test failures are due to Keith's patch, which he just landed a fix for.  So, I'm going to land this one.
Comment 5 Mark Lam 2021-07-14 15:11:18 PDT
Landed in r279924: <http://trac.webkit.org/r279924>.