Bug 218528

Summary: Flaky crash in WebKit::CacheStorage::Caches::writeRecord
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: anthony.bowker, cdumez, marcel.pursche, sihui_liu, webkit-bot-watchers-bugzilla, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
crash log
none
Example webpage to reproduce the bug none

Description Ryan Haddad 2020-11-03 12:03:50 PST
imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html appears to be a flaky crash on iOS and macOS bots with the following backtrace:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebKit              	0x000000010fe15e2c WebKit::CacheStorage::Caches::writeRecord(WebKit::CacheStorage::Cache const&, WebKit::CacheStorage::RecordInformation const&, WebCore::DOMCacheEngine::Record&&, unsigned long long, WTF::CompletionHandler<void (WTF::Optional<WebCore::DOMCacheEngine::Error>&&)>&&) + 110 (CacheStorageEngineCaches.cpp:552)
1   com.apple.WebKit              	0x000000010fe0089a WebKit::CacheStorage::Cache::writeRecordToDisk(WebKit::CacheStorage::RecordInformation const&, WebCore::DOMCacheEngine::Record&&, WTF::Ref<WebKit::CacheStorage::AsynchronousPutTaskCounter, WTF::DumbPtrTraits<WebKit::CacheStorage::AsynchronousPutTaskCounter> >&&, unsigned long long) + 96 (CacheStorageEngineCache.cpp:497)
2   com.apple.WebKit              	0x000000010fe0064f WebKit::CacheStorage::Cache::storeRecords(WTF::Vector<WebCore::DOMCacheEngine::Record, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&&, WTF::CompletionHandler<void (std::experimental::fundamentals_v3::expected<WTF::Vector<unsigned long long, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>, WebCore::DOMCacheEngine::Error>&&)>&&) + 359 (CacheStorageEngineCache.cpp:409)
3   com.apple.WebKit              	0x000000010fe1ead3 WTF::Detail::CallableWrapper<WebKit::CacheStorage::Caches::requestSpace(unsigned long long, WTF::CompletionHandler<void (WTF::Optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_21, void, WebCore::StorageQuotaManager::Decision>::call(WebCore::StorageQuotaManager::Decision) + 65 (Function.h:52)
4   com.apple.WebCore             	0x00000001147d6dde WTF::Detail::CallableWrapper<WebCore::StorageQuotaManager::requestSpaceOnMainThread(unsigned long long, WTF::CompletionHandler<void (WebCore::StorageQuotaManager::Decision)>&&)::$_0::operator()()::'lambda'(), void>::call() + 30 (Function.h:52)
5   com.apple.JavaScriptCore      	0x00000001178c8d83 WTF::RunLoop::performWork() + 483 (RunLoop.cpp:124)

https://results.webkit.org/?suite=layout-tests&test=imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html
Comment 1 Ryan Haddad 2020-11-03 12:04:01 PST
Created attachment 413088 [details]
crash log
Comment 2 Radar WebKit Bug Importer 2020-11-03 12:05:56 PST
<rdar://problem/71005205>
Comment 3 Marcel Pursche 2021-10-21 09:05:44 PDT
Created attachment 442036 [details]
Example webpage to reproduce the bug

I was able to reproduce the bug on Safari for iOS 14.8 with the attached webpage.
I would expect cache.put() to fail if a file is to large but instead the browser crashes.