[Webkit-unassigned] [Bug 189460] run-webkit-tests --world-leaks unexpectedly says svg/text/text-text-05-t.svg leaks a document

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 15 16:50:41 PST 2019


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

--- Comment #12 from Joseph Pecoraro <joepeck at webkit.org> ---
Looks like in LayoutTests the FontCascadeFonts is held onto by the FontCascade inside of the document's StyleResolver:

    >>> FontCascadeFonts::FontCascadeFonts(FontSelector) - 0x3ee2805a0 (1)
    1   0x3d2aa1386 WebCore::FontCascadeFonts::FontCascadeFonts(WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&)
    2   0x3d2aa151d WebCore::FontCascadeFonts::FontCascadeFonts(WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&)
    3   0x3d2aabc2f WebCore::FontCascadeFonts::create(WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&)
    4   0x3d2a984f3 WebCore::retrieveOrAddCachedFonts(WebCore::FontCascadeDescription const&, WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&)
    5   0x3d2a9831f WebCore::FontCascade::update(WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&) const
    6   0x3d1b18b19 WebCore::StyleResolver::updateFont()
    7   0x3d1b16d55 WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const&, WebCore::StyleResolver::ShouldUseMatchedPropertiesCache)
    8   0x3d1b0aeea WebCore::StyleResolver::styleForElement(WebCore::Element const&, WebCore::RenderStyle const*, WebCore::RenderStyle const*, WebCore::RuleMatchingBehavior, WebCore::SelectorFilter const*)
    9   0x3d1d5181f WebCore::Element::resolveStyle(WebCore::RenderStyle const*)
    10  0x3d341c2ef WebCore::SVGElement::resolveCustomStyle(WebCore::RenderStyle const&, WebCore::RenderStyle const*)
    11  0x3d3346bd2 WebCore::Style::TreeResolver::styleForElement(WebCore::Element&, WebCore::RenderStyle const&)
    12  0x3d33471f0 WebCore::Style::TreeResolver::resolveElement(WebCore::Element&)
    13  0x3d3348af9 WebCore::Style::TreeResolver::resolveComposedTree()
    14  0x3d33498b8 WebCore::Style::TreeResolver::resolve()
    15  0x3d1c8c77a WebCore::Document::resolveStyle(WebCore::Document::ResolveStyleType)
    16  0x3d1c8d9bd WebCore::Document::updateStyleIfNeeded()
    17  0x3d1ca5730 WebCore::Document::finishedParsing()
    18  0x3d3816fe4 WebCore::XMLDocumentParser::end()
    19  0x3d38176ea WebCore::XMLDocumentParser::resumeParsing()
    20  0x3d38174ac WebCore::XMLDocumentParser::notifyFinished(WebCore::PendingScript&)
    21  0x3d1e0a307 WebCore::PendingScript::notifyClientFinished()
    22  0x3d1e0a369 WebCore::PendingScript::notifyFinished(WebCore::LoadableScript&)
    23  0x3d1da8ac6 WebCore::LoadableScript::notifyClientFinished()
    24  0x3d1da88b0 WebCore::LoadableClassicScript::notifyFinished(WebCore::CachedResource&)
    25  0x3d26d527f WebCore::CachedResource::checkNotify()
    26  0x3d26d0591 WebCore::CachedResource::finishLoading(WebCore::SharedBuffer*)
    27  0x3d26fe9df WebCore::CachedScript::finishLoading(WebCore::SharedBuffer*)
    28  0x3d2650971 WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&)
    29  0x3c8ddef93 WebKit::WebResourceLoader::didFinishResourceLoad(WebCore::NetworkLoadMetrics const&)
    30  0x3c917c1fa void IPC::callMemberFunctionImpl<WebKit::WebResourceLoader, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&), std::__1::tuple<WebCore::NetworkLoadMetrics>, 0ul>(WebKit::WebResourceLoader*, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&), std::__1::tuple<WebCore::NetworkLoadMetrics>&&, std::__1::integer_sequence<unsigned long, 0ul>)
    31  0x3c917bfb0 void IPC::callMemberFunction<WebKit::WebResourceLoader, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&), std::__1::tuple<WebCore::NetworkLoadMetrics>, std::__1::integer_sequence<unsigned long, 0ul> >(std::__1::tuple<WebCore::NetworkLoadMetrics>&&, WebKit::WebResourceLoader*, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&))

    >>> FontCascadeFonts::ref - 0x3ee2805a0 (2)
    1   0x3d2aa1974 WebCore::FontCascadeFonts::ref() const
    2   0x3d2aadf84 WTF::Ref<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::Ref(WebCore::FontCascadeFonts&)
    3   0x3d2aabb3d WTF::Ref<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::Ref(WebCore::FontCascadeFonts&)
    4   0x3d2a98566 WebCore::retrieveOrAddCachedFonts(WebCore::FontCascadeDescription const&, WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&)
    5   0x3d2a9831f WebCore::FontCascade::update(WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&) const
    6   0x3d1b18b19 WebCore::StyleResolver::updateFont()
    7   0x3d1b16d55 WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const&, WebCore::StyleResolver::ShouldUseMatchedPropertiesCache)
    8   0x3d1b0aeea WebCore::StyleResolver::styleForElement(WebCore::Element const&, WebCore::RenderStyle const*, WebCore::RenderStyle const*, WebCore::RuleMatchingBehavior, WebCore::SelectorFilter const*)
    9   0x3d1d5181f WebCore::Element::resolveStyle(WebCore::RenderStyle const*)
    10  0x3d341c2ef WebCore::SVGElement::resolveCustomStyle(WebCore::RenderStyle const&, WebCore::RenderStyle const*)
    11  0x3d3346bd2 WebCore::Style::TreeResolver::styleForElement(WebCore::Element&, WebCore::RenderStyle const&)
    12  0x3d33471f0 WebCore::Style::TreeResolver::resolveElement(WebCore::Element&)
    13  0x3d3348af9 WebCore::Style::TreeResolver::resolveComposedTree()
    14  0x3d33498b8 WebCore::Style::TreeResolver::resolve()
    15  0x3d1c8c77a WebCore::Document::resolveStyle(WebCore::Document::ResolveStyleType)
    16  0x3d1c8d9bd WebCore::Document::updateStyleIfNeeded()
    17  0x3d1ca5730 WebCore::Document::finishedParsing()
    18  0x3d3816fe4 WebCore::XMLDocumentParser::end()
    19  0x3d38176ea WebCore::XMLDocumentParser::resumeParsing()
    20  0x3d38174ac WebCore::XMLDocumentParser::notifyFinished(WebCore::PendingScript&)
    21  0x3d1e0a307 WebCore::PendingScript::notifyClientFinished()
    22  0x3d1e0a369 WebCore::PendingScript::notifyFinished(WebCore::LoadableScript&)
    23  0x3d1da8ac6 WebCore::LoadableScript::notifyClientFinished()
    24  0x3d1da88b0 WebCore::LoadableClassicScript::notifyFinished(WebCore::CachedResource&)
    25  0x3d26d527f WebCore::CachedResource::checkNotify()
    26  0x3d26d0591 WebCore::CachedResource::finishLoading(WebCore::SharedBuffer*)
    27  0x3d26fe9df WebCore::CachedScript::finishLoading(WebCore::SharedBuffer*)
    28  0x3d2650971 WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&)
    29  0x3c8ddef93 WebKit::WebResourceLoader::didFinishResourceLoad(WebCore::NetworkLoadMetrics const&)
    30  0x3c917c1fa void IPC::callMemberFunctionImpl<WebKit::WebResourceLoader, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&), std::__1::tuple<WebCore::NetworkLoadMetrics>, 0ul>(WebKit::WebResourceLoader*, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&), std::__1::tuple<WebCore::NetworkLoadMetrics>&&, std::__1::integer_sequence<unsigned long, 0ul>)
    31  0x3c917bfb0 void IPC::callMemberFunction<WebKit::WebResourceLoader, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&), std::__1::tuple<WebCore::NetworkLoadMetrics>, std::__1::integer_sequence<unsigned long, 0ul> >(std::__1::tuple<WebCore::NetworkLoadMetrics>&&, WebKit::WebResourceLoader*, void (WebKit::WebResourceLoader::*)(WebCore::NetworkLoadMetrics const&))


    >>> FontCascadeFonts::ref - 0x3ee2805a0 (3)
    1   0x3d2aa1974 WebCore::FontCascadeFonts::ref() const
    2   0x3d2aadf84 WTF::Ref<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::Ref(WebCore::FontCascadeFonts&)
    3   0x3d2aabb3d WTF::Ref<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::Ref(WebCore::FontCascadeFonts&)
    4   0x3d2a984a2 WebCore::retrieveOrAddCachedFonts(WebCore::FontCascadeDescription const&, WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&)
    5   0x3d2a9831f WebCore::FontCascade::update(WTF::RefPtr<WebCore::FontSelector, WTF::DumbPtrTraits<WebCore::FontSelector> >&&) const
    6   0x3d3274f03 WebCore::RenderSVGInlineText::computeNewScaledFontForStyle(WebCore::RenderObject const&, WebCore::RenderStyle const&, float&, WebCore::FontCascade&)
    7   0x3d3273dc0 WebCore::RenderSVGInlineText::updateScaledFont()
    ..
    >>> FontCascadeFonts::deref - 0x3ee2805a0 (2)
    1   0x3d2aa19e4 WebCore::FontCascadeFonts::deref() const
    2   0x3d228c6de void WTF::derefIfNotNull<WebCore::FontCascadeFonts>(WebCore::FontCascadeFonts*)
    3   0x3d228c6a9 WTF::RefPtr<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::~RefPtr()
    4   0x3d228c655 WTF::RefPtr<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::~RefPtr()
    5   0x3d2a97969 WTF::RefPtr<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::operator=(WTF::RefPtr<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> > const&)
    6   0x3d2a97853 WebCore::FontCascade::operator=(WebCore::FontCascade const&)
    7   0x3d3274eaf WebCore::RenderSVGInlineText::computeNewScaledFontForStyle(WebCore::RenderObject const&, WebCore::RenderStyle const&, float&, WebCore::FontCascade&)
    8   0x3d3273dc0 WebCore::RenderSVGInlineText::updateScaledFont()
    ...

    >>> pruneUnreferencedEntriesFromFontCascadeCache
    >>>     ...
    >>>     ENTRY: 0x3ee2805a0 [2] [custom font]


In MiniBrowser the StyleResolver / FontCascade / FontCascadeFonts get destroyed as part of releaseMemory:

    static void releaseCriticalMemory(Synchronous synchronous, MaintainPageCache maintainPageCache)
    {
        ...
        for (auto& document : copyToVectorOf<RefPtr<Document>>(Document::allDocuments())) {
            document->styleScope().releaseMemory();
            document->fontSelector().emptyCaches();
            document->cachedResourceLoader().garbageCollectDocumentResources();
        }
        ...
    }

    --------

    void Scope::clearResolver()
    {
        m_resolver = nullptr;

        if (!m_shadowRoot)
            m_document.didClearStyleResolver();
    }

    void Scope::releaseMemory()
    {
        if (!m_shadowRoot) {
            for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots())
                descendantShadowRoot->styleScope().releaseMemory();
        }

    #if ENABLE(CSS_SELECTOR_JIT)
        for (auto& sheet : m_activeStyleSheets) {
            sheet->contents().traverseRules([] (const StyleRuleBase& rule) {
                if (is<StyleRule>(rule))
                    downcast<StyleRule>(rule).releaseCompiledSelectors();
                return false;
            });
        }
    #endif

        clearResolver();
    }

    --------

    >>> FontCascadeFonts::deref - 0x441be1a20 (1)
    1   0x4231139e4 WebCore::FontCascadeFonts::deref() const
    2   0x4228fe6de void WTF::derefIfNotNull<WebCore::FontCascadeFonts>(WebCore::FontCascadeFonts*)
    3   0x4228fe6a9 WTF::RefPtr<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::~RefPtr()
    4   0x4228fe655 WTF::RefPtr<WebCore::FontCascadeFonts, WTF::DumbPtrTraits<WebCore::FontCascadeFonts> >::~RefPtr()
    5   0x4228fe613 WebCore::FontCascade::~FontCascade()
    6   0x4228ecfc5 WebCore::FontCascade::~FontCascade()
    7   0x4238bb5a7 WebCore::StyleInheritedData::~StyleInheritedData()
    8   0x4238bb535 WebCore::StyleInheritedData::~StyleInheritedData()
    9   0x4238bb507 WTF::RefCounted<WebCore::StyleInheritedData>::deref() const
    10  0x4238bb48f WTF::Ref<WebCore::StyleInheritedData, WTF::DumbPtrTraits<WebCore::StyleInheritedData> >::~Ref()
    11  0x42389c3a5 WTF::Ref<WebCore::StyleInheritedData, WTF::DumbPtrTraits<WebCore::StyleInheritedData> >::~Ref()
    12  0x4238b2035 WebCore::DataRef<WebCore::StyleInheritedData>::~DataRef()
    13  0x42389c5b5 WebCore::DataRef<WebCore::StyleInheritedData>::~DataRef()
    14  0x42389c4fb WebCore::RenderStyle::~RenderStyle()
    15  0x42389b145 WebCore::RenderStyle::~RenderStyle()
    16  0x42219f0ab std::__1::default_delete<WebCore::RenderStyle>::operator()(WebCore::RenderStyle*) const
    17  0x42219f02f std::__1::unique_ptr<WebCore::RenderStyle, std::__1::default_delete<WebCore::RenderStyle> >::reset(WebCore::RenderStyle*)
    18  0x4221a9759 std::__1::unique_ptr<WebCore::RenderStyle, std::__1::default_delete<WebCore::RenderStyle> >::~unique_ptr()
    19  0x42217d055 std::__1::unique_ptr<WebCore::RenderStyle, std::__1::default_delete<WebCore::RenderStyle> >::~unique_ptr()
    20  0x4221a2e13 WebCore::StyleResolver::MatchedPropertiesCacheItem::~MatchedPropertiesCacheItem()
    21  0x42218f1a5 WebCore::StyleResolver::MatchedPropertiesCacheItem::~MatchedPropertiesCacheItem()
    22  0x42219df69 WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem>::~KeyValuePair()
    23  0x42219df35 WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem>::~KeyValuePair()
    24  0x42219deca WTF::HashTable<unsigned int, WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem> >, WTF::IntHash<unsigned int>, WTF::HashMap<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem, WTF::IntHash<unsigned int>, WTF::HashTraits<unsigned int>, WTF::HashTraits<WebCore::StyleResolver::MatchedPropertiesCacheItem> >::KeyValuePairTraits, WTF::HashTraits<unsigned int> >::deallocateTable(WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem>*, unsigned int)
    25  0x42219dda6 WTF::HashTable<unsigned int, WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem> >, WTF::IntHash<unsigned int>, WTF::HashMap<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem, WTF::IntHash<unsigned int>, WTF::HashTraits<unsigned int>, WTF::HashTraits<WebCore::StyleResolver::MatchedPropertiesCacheItem> >::KeyValuePairTraits, WTF::HashTraits<unsigned int> >::~HashTable()
    26  0x42219dd65 WTF::HashTable<unsigned int, WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem> >, WTF::IntHash<unsigned int>, WTF::HashMap<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem, WTF::IntHash<unsigned int>, WTF::HashTraits<unsigned int>, WTF::HashTraits<WebCore::StyleResolver::MatchedPropertiesCacheItem> >::KeyValuePairTraits, WTF::HashTraits<unsigned int> >::~HashTable()
    27  0x42219dd45 WTF::HashMap<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem, WTF::IntHash<unsigned int>, WTF::HashTraits<unsigned int>, WTF::HashTraits<WebCore::StyleResolver::MatchedPropertiesCacheItem> >::~HashMap()
    28  0x422187915 WTF::HashMap<unsigned int, WebCore::StyleResolver::MatchedPropertiesCacheItem, WTF::IntHash<unsigned int>, WTF::HashTraits<unsigned int>, WTF::HashTraits<WebCore::StyleResolver::MatchedPropertiesCacheItem> >::~HashMap()
    29  0x42218787e WebCore::StyleResolver::~StyleResolver()
    30  0x422187955 WebCore::StyleResolver::~StyleResolver()
    31  0x4239c3cbb std::__1::default_delete<WebCore::StyleResolver>::operator()(WebCore::StyleResolver*) const

Next up I have to check which documents releaseCriticalMemory acted on, and if the StyleResolver is getting destroyed. If they do, then understanding whats happening with a RenderStyle that didn't release the FontCascade / FontCascadeFonts.

-- 
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/20190116/4c1179f0/attachment-0001.html>


More information about the webkit-unassigned mailing list