RESOLVED FIXED 229113
ThreadSanitizer: ignore uninteresting data races for reference counting of static WTF::StringImpl objects
https://bugs.webkit.org/show_bug.cgi?id=229113
Summary ThreadSanitizer: ignore uninteresting data races for reference counting of st...
David Kilzer (:ddkilzer)
Reported 2021-08-14 13:25:27 PDT
ThreadSanitizer: ignore uninteresting data races for reference counting of static WTF::StringImpl objects. Calls to WTF::StringImpl::isStatic(), WTF::StringImpl::ref() and WTF::StringImpl::deref() for static WTF::StringImpl objects result in uninteresting data races since static WTF::StringImpl objects are never released (because they start with a refcount of 1, and refcounts are incremented or decremented by 2). The WTF::StringImpl::s_emptyAtomString object generates hundreds of reports when running layout tests with TSan, such as this, which simply aren't interesting: ================== WARNING: ThreadSanitizer: data race (pid=64095) Write of size 4 at 0x00011ca70258 by thread T3: #0 WTF::StringImpl::ref() <null> (JavaScriptCore:x86_64+0x18da1a0) #1 WTF::Ref<WTF::StringImpl, WTF::RawPtrTraits<WTF::StringImpl> >::Ref(WTF::StringImpl&) <null> (JavaScriptCore:x86_64+0x18e5b88) #2 WTF::Ref<WTF::StringImpl, WTF::RawPtrTraits<WTF::StringImpl> >::Ref(WTF::StringImpl&) <null> (JavaScriptCore:x86_64+0xe270) #3 WTF::Ref<WTF::StringImpl, WTF::RawPtrTraits<WTF::StringImpl> > WTF::StringImpl::createInternal<unsigned char>(unsigned char const*, unsigned int) <null> (JavaScriptCore:x86_64+0x9dd99) #4 WTF::StringImpl::create(unsigned char const*, unsigned int) <null> (JavaScriptCore:x86_64+0x9dd09) #5 WTF::StringImpl::substring(unsigned int, unsigned int) <null> (JavaScriptCore:x86_64+0x9e174) #6 WTF::String::substring(unsigned int, unsigned int) const <null> (JavaScriptCore:x86_64+0x11446e) #7 WebCore::SecurityOriginData::fromDatabaseIdentifier(WTF::String const&) <null> (WebCore:x86_64+0x2db32d0) #8 WebKit::getSecurityOriginData(char const*, WebCore::KeyedDecoder*) <null> (WebKit:x86_64+0x11501f8) #9 WebKit::DeviceIdHashSaltStorage::getDataFromDecoder(WebCore::KeyedDecoder*, WTF::String&&) const <null> (WebKit:x86_64+0x114fe39) #10 WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk(WTF::CompletionHandler<void (WTF::HashMap<WTF::String, std::__1::unique_ptr<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin, std::__1::default_delete<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin> >, WTF::DefaultHash<WTF::String>, WTF::HashTraits<WTF::String>, WTF::HashTraits<std::__1::unique_ptr<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin, std::__1::default_delete<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin> > >, WTF::HashTableTraits>&&)>&&)::$_6::operator()() <null> (WebKit:x86_64+0x115e7e9) #11 WTF::Detail::CallableWrapper<WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk(WTF::CompletionHandler<void (WTF::HashMap<WTF::String, std::__1::unique_ptr<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin, std::__1::default_delete<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin> >, WTF::DefaultHash<WTF::String>, WTF::HashTraits<WTF::String>, WTF::HashTraits<std::__1::unique_ptr<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin, std::__1::default_delete<WebKit::DeviceIdHashSaltStorage::HashSaltForOrigin> > >, WTF::HashTableTraits>&&)>&&)::$_6, void>::call() <null> (WebKit:x86_64+0x115e59d) #12 WTF::Function<void ()>::operator()() const <null> (JavaScriptCore:x86_64+0x2620d) #13 WTF::(anonymous namespace)::DispatchWorkItem::operator()() <null> (JavaScriptCore:x86_64+0x11285d) #14 void WTF::dispatchWorkItem<WTF::(anonymous namespace)::DispatchWorkItem>(void*) <null> (JavaScriptCore:x86_64+0x111849) #15 __tsan::dispatch_callback_wrap(void*) <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x734d1) #16 _dispatch_client_callout <null> (libdispatch.dylib:x86_64+0x34ff) Previous write of size 4 at 0x00011ca70258 by main thread: #0 WTF::StringImpl::ref() <null> (WebKit:x86_64+0x9150) #1 WTF::String::String(WTF::String const&) <null> (WebKit:x86_64+0x9118) #2 WTF::String::String(WTF::String const&) <null> (WebKit:x86_64+0x90c0) #3 WebCore::ResourceRequestBase::ResourceRequestBase(WTF::URL const&, WebCore::ResourceRequestCachePolicy) <null> (WebKit:x86_64+0x79ac1) #4 WebCore::ResourceRequest::ResourceRequest() <null> (WebKit:x86_64+0x799bf) #5 WebCore::ResourceRequest::ResourceRequest() <null> (WebKit:x86_64+0x79909) #6 WebKit::FrameInfoData::FrameInfoData() <null> (WebKit:x86_64+0x1276ce9) #7 WebKit::FrameInfoData::FrameInfoData() <null> (WebKit:x86_64+0x12769e9) #8 WebKit::WebAuthenticationRequestData::WebAuthenticationRequestData() <null> (WebKit:x86_64+0x1276880) #9 WebKit::WebAuthenticationRequestData::WebAuthenticationRequestData() <null> (WebKit:x86_64+0x1276679) #10 WebKit::AuthenticatorManager::AuthenticatorManager() <null> (WebKit:x86_64+0x16ea81d) #11 WebKit::AuthenticatorManager::AuthenticatorManager() <null> (WebKit:x86_64+0x16eaaf9) #12 WTF::UniqueRef<WebKit::AuthenticatorManager> WTF::makeUniqueRefWithoutFastMallocCheck<WebKit::AuthenticatorManager>() <null> (WebKit:x86_64+0x17a3447) #13 WTF::UniqueRef<WebKit::AuthenticatorManager> WTF::makeUniqueRef<WebKit::AuthenticatorManager>() <null> (WebKit:x86_64+0x17875a9) #14 WebKit::WebsiteDataStore::WebsiteDataStore(WTF::Ref<WebKit::WebsiteDataStoreConfiguration, WTF::RawPtrTraits<WebKit::WebsiteDataStoreConfiguration> >&&, PAL::SessionID) <null> (WebKit:x86_64+0x1786d5d) #15 WebKit::WebsiteDataStore::WebsiteDataStore(WTF::Ref<WebKit::WebsiteDataStoreConfiguration, WTF::RawPtrTraits<WebKit::WebsiteDataStoreConfiguration> >&&, PAL::SessionID) <null> (WebKit:x86_64+0x1786b29) #16 WebKit::WebsiteDataStore::create(WTF::Ref<WebKit::WebsiteDataStoreConfiguration, WTF::RawPtrTraits<WebKit::WebsiteDataStoreConfiguration> >&&, PAL::SessionID) <null> (WebKit:x86_64+0x1786b87) #17 WKWebsiteDataStoreCreateWithConfiguration <null> (WebKit:x86_64+0x1554bd6) #18 WTR::TestController::defaultWebsiteDataStore() <null> (WebKitTestRunner:x86_64+0x10005740d) #19 WTR::initializeWebViewConfiguration(char const*, OpaqueWKString const*, OpaqueWKContext const*, OpaqueWKContextConfiguration const*)::$_0::operator()() const <null> (WebKitTestRunner:x86_64+0x10008078b) #20 WTR::initializeWebViewConfiguration(char const*, OpaqueWKString const*, OpaqueWKContext const*, OpaqueWKContextConfiguration const*) <null> (WebKitTestRunner:x86_64+0x1000806b7) #21 WTR::TestController::platformAdjustContext(OpaqueWKContext const*, OpaqueWKContextConfiguration const*) <null> (WebKitTestRunner:x86_64+0x10008234a) #22 WTR::TestController::generatePageConfiguration(WTR::TestOptions const&) <null> (WebKitTestRunner:x86_64+0x100057555) #23 WTR::TestController::createWebViewWithOptions(WTR::TestOptions const&) <null> (WebKitTestRunner:x86_64+0x100057dd6) #24 WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&) <null> (WebKitTestRunner:x86_64+0x1000587a1) #25 WTR::TestController::configureViewForTest(WTR::TestInvocation const&) <null> (WebKitTestRunner:x86_64+0x10005b480) #26 WTR::TestInvocation::invoke() <null> (WebKitTestRunner:x86_64+0x10009784c) #27 WTR::TestController::runTest(char const*) <null> (WebKitTestRunner:x86_64+0x10005b66e) #28 WTR::TestController::runTestingServerLoop() <null> (WebKitTestRunner:x86_64+0x10005ba17) #29 WTR::TestController::run() <null> (WebKitTestRunner:x86_64+0x10005523d) #30 WTR::TestController::TestController(int, char const**) <null> (WebKitTestRunner:x86_64+0x100054d4b) #31 WTR::TestController::TestController(int, char const**) <null> (WebKitTestRunner:x86_64+0x1000552e9) #32 main <null> (WebKitTestRunner:x86_64+0x10000804a) Location is global 'WTF::StringImpl::s_emptyAtomString' at 0x00011ca70258 (JavaScriptCore+0x00000224a258) Thread T3 (tid=13697474, running) is a GCD worker thread SUMMARY: ThreadSanitizer: data race (WebKitBuild/JavaScriptCore.framework/Versions/A/JavaScriptCore:x86_64+0x18da1a0) in WTF::StringImpl::ref()+0x20 ==================
Attachments
Patch v1 (2.23 KB, patch)
2021-08-14 13:31 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2021-08-14 13:31:50 PDT
Created attachment 435548 [details] Patch v1
EWS
Comment 2 2021-08-16 09:50:05 PDT
Committed r281091 (240551@main): <https://commits.webkit.org/240551@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 435548 [details].
Radar WebKit Bug Importer
Comment 3 2021-08-16 09:51:43 PDT
Note You need to log in before you can comment on or make changes to this bug.