Summary: | Avoid unnecessarily constructing RunLoops for GC AutomaticThreads in Connection::sendMessage() after r228001 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||||
Component: | Service Workers | Assignee: | Chris Dumez <cdumez> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | beidson, commit-queue, ews-watchlist, fpizlo, ggaren, Hironori.Fujii, mitz, rniwa, youennf | ||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||
Version: | WebKit Nightly Build | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=182104 | ||||||||||||
Attachments: |
|
Description
Chris Dumez
2018-02-05 10:17:32 PST
Created attachment 333092 [details]
Patch
Comment on attachment 333092 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333092&action=review > Source/WebKit/ChangeLog:24 > + Looking at the code, the most likely one is when constructing the ThreadSpecific: > + """ > + int error = pthread_key_create(&m_key, destroy); > + if (error) > + CRASH(); > + """ I don’t think that’s correct. When I hit this crash, it looked like what was failing was RELEASE_ASSERT(canBeGCThread == CanBeGCThread::True || !mayBeGCThread()) in the ThreadSpecific constructor. (In reply to mitz from comment #3) > Comment on attachment 333092 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=333092&action=review > > > Source/WebKit/ChangeLog:24 > > + Looking at the code, the most likely one is when constructing the ThreadSpecific: > > + """ > > + int error = pthread_key_create(&m_key, destroy); > > + if (error) > > + CRASH(); > > + """ > > I don’t think that’s correct. When I hit this crash, it looked like what was > failing was RELEASE_ASSERT(canBeGCThread == CanBeGCThread::True || > !mayBeGCThread()) in the ThreadSpecific constructor. That is interesting. RunLoop::current() is implemented like so: RunLoop& RunLoop::current() { static NeverDestroyed<ThreadSpecific<Holder, CanBeGCThread::True>> runLoopHolder; return runLoopHolder.get()->runLoop(); } So this assertion should have been disabled due to CanBeGCThread::True. Either way, switching to isMainThread() will bypass this code path entirely. (In reply to Chris Dumez from comment #4) > (In reply to mitz from comment #3) > > Comment on attachment 333092 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=333092&action=review > > > > > Source/WebKit/ChangeLog:24 > > > + Looking at the code, the most likely one is when constructing the ThreadSpecific: > > > + """ > > > + int error = pthread_key_create(&m_key, destroy); > > > + if (error) > > > + CRASH(); > > > + """ > > > > I don’t think that’s correct. When I hit this crash, it looked like what was > > failing was RELEASE_ASSERT(canBeGCThread == CanBeGCThread::True || > > !mayBeGCThread()) in the ThreadSpecific constructor. > > That is interesting. RunLoop::current() is implemented like so: > RunLoop& RunLoop::current() > { > static NeverDestroyed<ThreadSpecific<Holder, CanBeGCThread::True>> > runLoopHolder; > return runLoopHolder.get()->runLoop(); > } > > So this assertion should have been disabled due to CanBeGCThread::True. > Either way, switching to isMainThread() will bypass this code path entirely. Found it, somebody made this change very recently: https://bugs.webkit.org/show_bug.cgi?id=182104 Previously, it was not allowed to call this method from a GC thread. Created attachment 333096 [details]
Patch
So this crash is a duplicate of bug 182104, and is already fixed. Perhaps the idea of changing Connection::sendMessage() should be tracked separately (or this bug retitled and separated from the Radar). (In reply to mitz from comment #7) > So this crash is a duplicate of bug 182104, and is already fixed. Perhaps > the idea of changing Connection::sendMessage() should be tracked separately > (or this bug retitled and separated from the Radar). Well, there is "fixed" and "fixed". We keep constructing RunLoops for AutomaticThreads for no reason now. Created attachment 333097 [details]
Patch
Comment on attachment 333097 [details] Patch Attachment 333097 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/6372965 New failing tests: fast/scrolling/scroll-to-focused-element-asynchronously.html Created attachment 333132 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2
The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Comment on attachment 333097 [details] Patch Clearing flags on attachment: 333097 Committed r228152: <https://trac.webkit.org/changeset/228152> All reviewed patches have been landed. Closing bug. |