Bug 211365

Summary: [GTK] Tests exiting early due to TextureMapperShaderProgram variables ASSERTING isMainThread
Product: WebKit Reporter: Lauro Moura <lmoura>
Component: WebKitGTKAssignee: Zan Dobersek <zan>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: bugs-noreply, cmarcelo, ews-watchlist, kondapallykalyan, luiz, noam, ysuzuki, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=161800
https://bugs.webkit.org/show_bug.cgi?id=211264
Attachments:
Description Flags
Patch none

Description Lauro Moura 2020-05-03 21:08:27 PDT
From bug161800:

>> Since AtomString has thread-affinity, static NeverDestroyed<const AtomString> is basically only safe for the main-thread use.
>> We should ensure that this is only used in the main-thread. To do that, this patch introduces MainThreadNeverDestroyed and
>> MainThreadLazyNeverDestroyed. They are NeverDestroyed and LazyNeverDestroyed + main-thread assertions.

The patch for that bug changed the TEXMAP_DECLARE_VARIABLE field 'name' type from NeverDestroyed to MainThreadNeverDestroyed.

Sample backtrace:

ASSERTION FAILED: isMainThread()
DerivedSources/ForwardingHeaders/wtf/NeverDestroyed.h(55) : static void WTF::MainThreadAccessTraits::assertAccess()
1   0x7efd83ffb94f WTFCrash
2   0x7efd91e1eb7a WTF::ConditionalCrashOnOverflow::setShouldCrashOnOverflow(bool)
3   0x7efd93529bcf WTF::MainThreadAccessTraits::assertAccess()
4   0x7efd9352ba49 WTF::NeverDestroyed<WTF::AtomString const, WTF::MainThreadAccessTraits>::NeverDestroyed<char const (&) [10], WTF::AtomString::ConstructFromLiteralTag>(char const (&) [10], WTF::AtomString::ConstructFromLiteralTag&&)
5   0x7efd9352a95e WebCore::TextureMapperShaderProgram::samplerLocation()
6   0x7efd9352812c WebCore::TextureMapperGL::drawTexturedQuadWithProgram(WebCore::TextureMapperShaderProgram&, unsigned int, int, WebCore::IntSize const&, WebCore::FloatRect const&, WebCore::TransformationMatrix const&, float)
7   0x7efd93526441 WebCore::TextureMapperGL::drawTexture(unsigned int, int, WebCore::IntSize const&, WebCore::FloatRect const&, WebCore::TransformationMatrix const&, float, unsigned int)
8   0x7efd935260e7 WebCore::TextureMapperGL::drawTexture(WebCore::BitmapTexture const&, WebCore::FloatRect const&, WebCore::TransformationMatrix const&, float, unsigned int)
9   0x7efd96643b2e WebCore::TextureMapperTile::paint(WebCore::TextureMapper&, WebCore::TransformationMatrix const&, float, unsigned int)
10  0x7efd9353ab45 WebCore::CoordinatedBackingStore::paintTilesToTextureMapper(WTF::Vector<WebCore::TextureMapperTile*, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WebCore::TextureMapper&, WebCore::TransformationMatrix const&, float, WebCore::FloatRect const&)
11  0x7efd9353afe4 WebCore::CoordinatedBackingStore::paintToTextureMapper(WebCore::TextureMapper&, WebCore::FloatRect const&, WebCore::TransformationMatrix const&, float)
12  0x7efd9351cf2c WebCore::TextureMapperLayer::paintSelf(WebCore::TextureMapperPaintOptions const&)
13  0x7efd9351d4fa WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
14  0x7efd9351dae6 WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica(WebCore::TextureMapperPaintOptions const&)
15  0x7efd9351f8c9 WebCore::TextureMapperLayer::paintRecursive(WebCore::TextureMapperPaintOptions const&)
16  0x7efd9351d77f WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
17  0x7efd9351dae6 WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica(WebCore::TextureMapperPaintOptions const&)
18  0x7efd9351f8c9 WebCore::TextureMapperLayer::paintRecursive(WebCore::TextureMapperPaintOptions const&)
19  0x7efd9351d77f WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
20  0x7efd9351dae6 WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica(WebCore::TextureMapperPaintOptions const&)
21  0x7efd9351f8c9 WebCore::TextureMapperLayer::paintRecursive(WebCore::TextureMapperPaintOptions const&)
22  0x7efd9351d77f WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
23  0x7efd9351dae6 WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica(WebCore::TextureMapperPaintOptions const&)
24  0x7efd9351f8c9 WebCore::TextureMapperLayer::paintRecursive(WebCore::TextureMapperPaintOptions const&)
25  0x7efd9351d77f WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
26  0x7efd9351dae6 WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica(WebCore::TextureMapperPaintOptions const&)
27  0x7efd9351f8c9 WebCore::TextureMapperLayer::paintRecursive(WebCore::TextureMapperPaintOptions const&)
28  0x7efd9351d77f WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
29  0x7efd9351dae6 WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica(WebCore::TextureMapperPaintOptions const&)
30  0x7efd9351f8c9 WebCore::TextureMapperLayer::paintRecursive(WebCore::TextureMapperPaintOptions const&)
31  0x7efd9351d77f WebCore::TextureMapperLayer::paintSelfAndChildren(WebCore::TextureMapperPaintOptions const&)
Comment 1 Lauro Moura 2020-05-03 21:10:33 PDT
Sorry, the correct bug to be referenced is bug211264. (Which introduced this issue).

Bug 161800 is a previous fix for this specific TextureMapperShaderProgram piece regarding AtomString and threading (which solved the issues for a while but now needs some rework).
Comment 2 Yusuke Suzuki 2020-05-03 23:39:33 PDT
(In reply to Lauro Moura from comment #1)
> Sorry, the correct bug to be referenced is bug211264. (Which introduced this
> issue).
> 
> Bug 161800 is a previous fix for this specific TextureMapperShaderProgram
> piece regarding AtomString and threading (which solved the issues for a
> while but now needs some rework).

That patch introduces assertions and found suspicious use. I've uploaded the patch which fixes TextureMapperShaderProgram issue. https://bugs.webkit.org/show_bug.cgi?id=211355

*** This bug has been marked as a duplicate of bug 211355 ***
Comment 3 Zan Dobersek 2020-05-04 00:21:04 PDT
Reopening to attach new patch.
Comment 4 Zan Dobersek 2020-05-04 00:21:07 PDT
Created attachment 398350 [details]
Patch
Comment 5 Zan Dobersek 2020-05-04 00:33:54 PDT

*** This bug has been marked as a duplicate of bug 211355 ***