Bug 179248

Summary: LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, cgarcia, commit-queue, ews-watchlist, koivisto, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews104 for mac-sierra-wk2
none
Archive of layout-test-results from ews124 for ios-simulator-wk2
none
Patch
none
Further fix none

Ryan Haddad
Reported 2017-11-03 11:21:03 PDT
LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/r224399%20(5489)/results.html https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=imported%2Fw3c%2Fweb-platform-tests%2Fservice-workers%2Fservice-worker%2Ffetch-event-within-sw.https.html --- /Volumes/Data/slave/sierra-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https-expected.txt +++ /Volumes/Data/slave/sierra-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https-actual.txt @@ -1,4 +1,6 @@ -FAIL Service worker intercepts requests from window assert_equals: fetch intercepted expected "intercepted" but got "Hello world\n" -FAIL Service worker does not intercept fetch/cache requests within service worker assert_equals: fetch within SW not intercepted expected "Hello world\n" but got "{\"error\": {\"message\": \"\", \"code\": 404}}" +Harness Error (TIMEOUT), message = null +TIMEOUT Service worker intercepts requests from window Test timed out +NOTRUN Service worker does not intercept fetch/cache requests within service worker +
Attachments
Patch (4.45 KB, patch)
2018-03-01 10:42 PST, youenn fablet
no flags
Patch (6.09 KB, patch)
2018-03-01 11:46 PST, youenn fablet
no flags
Patch (6.92 KB, patch)
2018-03-01 12:06 PST, youenn fablet
no flags
Archive of layout-test-results from ews104 for mac-sierra-wk2 (2.62 MB, application/zip)
2018-03-01 13:16 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews124 for ios-simulator-wk2 (2.29 MB, application/zip)
2018-03-01 13:41 PST, EWS Watchlist
no flags
Patch (7.58 KB, patch)
2018-03-01 13:59 PST, youenn fablet
no flags
Further fix (2.10 KB, patch)
2018-03-02 09:41 PST, youenn fablet
no flags
Ryan Haddad
Comment 1 2017-11-03 14:29:46 PDT
Radar WebKit Bug Importer
Comment 2 2017-11-06 17:07:48 PST
Chris Dumez
Comment 3 2018-02-06 10:38:16 PST
Looks like this test is still flaky.
youenn fablet
Comment 4 2018-03-01 10:35:45 PST
Test is no longer timing out. It sometimes fails: --- /Volumes/Data/slave/highsierra-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https-expected.txt +++ /Volumes/Data/slave/highsierra-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https-actual.txt @@ -1,3 +1,4 @@ +CONSOLE MESSAGE: There was an error making test persistent on the filesystem PASS Service worker intercepts requests from window PASS Service worker does not intercept fetch/cache requests within service worker
youenn fablet
Comment 5 2018-03-01 10:42:27 PST
youenn fablet
Comment 6 2018-03-01 11:05:51 PST
Hum, got the following flaky crash. It seems like our callback given to is IOChannel::write is executed from main thread but sometimes destroyed in a secondary thread. Or maybe it is not even executed. Thread 8 Crashed:: Dispatch queue: com.apple.libdispatch-io.deviceq.1 0 com.apple.JavaScriptCore 0x000000011856a834 WTFCrash + 36 (Assertions.cpp:271) 1 com.apple.WebKit 0x0000000102590d61 WebKit::NetworkCache::Storage::~Storage() + 81 (NetworkCacheStorage.cpp:236) 2 com.apple.WebKit 0x0000000102591375 WebKit::NetworkCache::Storage::~Storage() + 21 (NetworkCacheStorage.cpp:242) 3 com.apple.WebKit 0x00000001023a87b7 WTF::ThreadSafeRefCounted<WebKit::NetworkCache::Storage>::deref() const + 71 (ThreadSafeRefCounted.h:71) 4 com.apple.WebKit 0x00000001023a8711 void WTF::derefIfNotNull<WebKit::NetworkCache::Storage>(WebKit::NetworkCache::Storage*) + 49 (RefPtr.h:46) 5 com.apple.WebKit 0x00000001023a86d9 WTF::RefPtr<WebKit::NetworkCache::Storage, WTF::DumbPtrTraits<WebKit::NetworkCache::Storage> >::~RefPtr() + 41 (RefPtr.h:70) 6 com.apple.WebKit 0x00000001023a1035 WTF::RefPtr<WebKit::NetworkCache::Storage, WTF::DumbPtrTraits<WebKit::NetworkCache::Storage> >::~RefPtr() + 21 (RefPtr.h:70) 7 com.apple.WebKit 0x00000001023a0f64 WebKit::CacheStorage::Caches::~Caches() + 164 (CacheStorageEngineCaches.cpp:56) 8 com.apple.WebKit 0x00000001023a1095 WebKit::CacheStorage::Caches::~Caches() + 21 (CacheStorageEngineCaches.cpp:56) 9 com.apple.WebKit 0x0000000102365fe7 WTF::RefCounted<WebKit::CacheStorage::Caches>::deref() const + 71 (RefCounted.h:145) 10 com.apple.WebKit 0x00000001023744cf WTF::Ref<WebKit::CacheStorage::Caches, WTF::DumbPtrTraits<WebKit::CacheStorage::Caches> >::~Ref() + 47 (Ref.h:62) 11 com.apple.WebKit 0x0000000102373ee5 WTF::Ref<WebKit::CacheStorage::Caches, WTF::DumbPtrTraits<WebKit::CacheStorage::Caches> >::~Ref() + 21 (Ref.h:62) 12 com.apple.WebKit 0x00000001023a656c WebKit::CacheStorage::Caches::storeOrigin(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_2::~$_2() + 44 (CacheStorageEngineCaches.cpp:97) 13 com.apple.WebKit 0x00000001023a16d5 WebKit::CacheStorage::Caches::storeOrigin(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_2::~$_2() + 21 (CacheStorageEngineCaches.cpp:97) 14 com.apple.WebKit 0x00000001023ab021 WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>::CallableWrapper<WebKit::CacheStorage::Caches::storeOrigin(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_2>::~CallableWrapper() + 49 (Function.h:91) 15 com.apple.WebKit 0x00000001023aaf25 WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>::CallableWrapper<WebKit::CacheStorage::Caches::storeOrigin(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_2>::~CallableWrapper() + 21 (Function.h:91) 16 com.apple.WebKit 0x00000001023aaf49 WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>::CallableWrapper<WebKit::CacheStorage::Caches::storeOrigin(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_2>::~CallableWrapper() + 25 (Function.h:91) 17 com.apple.WebKit 0x000000010236811f WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>::~Function() + 175 (memory:2603) 18 com.apple.WebKit 0x0000000102363815 WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>::~Function() + 21 (Forward.h:56) 19 com.apple.WebKit 0x0000000102376825 WebKit::CacheStorage::Engine::writeFile(WTF::String const&, WebKit::NetworkCache::Data&&, WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_9::operator()()::'lambda'(int)::~'lambda'(int)() + 21 (CacheStorageEngine.cpp:282) 20 com.apple.WebKit 0x0000000102375ea5 WebKit::CacheStorage::Engine::writeFile(WTF::String const&, WebKit::NetworkCache::Data&&, WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_9::operator()()::'lambda'(int)::~'lambda'(int)() + 21 (CacheStorageEngine.cpp:282) 21 com.apple.WebKit 0x00000001023765d1 WTF::Function<void (int)>::CallableWrapper<WebKit::CacheStorage::Engine::writeFile(WTF::String const&, WebKit::NetworkCache::Data&&, WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_9::operator()()::'lambda'(int)>::~CallableWrapper() + 49 (Function.h:91) 22 com.apple.WebKit 0x0000000102376485 WTF::Function<void (int)>::CallableWrapper<WebKit::CacheStorage::Engine::writeFile(WTF::String const&, WebKit::NetworkCache::Data&&, WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_9::operator()()::'lambda'(int)>::~CallableWrapper() + 21 (Function.h:91) 23 com.apple.WebKit 0x00000001023764a9 WTF::Function<void (int)>::CallableWrapper<WebKit::CacheStorage::Engine::writeFile(WTF::String const&, WebKit::NetworkCache::Data&&, WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&)::$_9::operator()()::'lambda'(int)>::~CallableWrapper() + 25 (Function.h:91) 24 com.apple.WebKit 0x00000001023767ff WTF::Function<void (int)>::~Function() + 175 (memory:2603) 25 com.apple.WebKit 0x0000000102375e85 WTF::Function<void (int)>::~Function() + 21 (Forward.h:56) 26 com.apple.WebKit 0x00000001025589c3 WebKit::NetworkCache::IOChannel::write(unsigned long, WebKit::NetworkCache::Data const&, WTF::WorkQueue*, WTF::Function<void (int)>&&)::$_2::~$_2() + 35 (NetworkCacheIOChannelCocoa.mm:115) 27 com.apple.WebKit 0x00000001025586d5 WebKit::NetworkCache::IOChannel::write(unsigned long, WebKit::NetworkCache::Data const&, WTF::WorkQueue*, WTF::Function<void (int)>&&)::$_2::~$_2() + 21 (NetworkCacheIOChannelCocoa.mm:115) 28 com.apple.WebKit 0x0000000102559230 WTF::BlockPtr<void (bool, NSObject<OS_dispatch_data>*, int)> WTF::BlockPtr<void (bool, NSObject<OS_dispatch_data>*, int)>::fromCallable<WebKit::NetworkCache::IOChannel::write(unsigned long, WebKit::NetworkCache::Data const&, WTF::WorkQueue*, WTF::Function<void (int)>&&)::$_2>(WebKit::NetworkCache::IOChannel::write(unsigned long, WebKit::NetworkCache::Data const&, WTF::WorkQueue*, WTF::Function<void (int)>&&)::$_2)::'lambda'(void const*)::operator()(void const*) const + 32 (BlockPtr.h:79) 29 com.apple.WebKit 0x0000000102559208 WTF::BlockPtr<void (bool, NSObject<OS_dispatch_data>*, int)> WTF::BlockPtr<void (bool, NSObject<OS_dispatch_data>*, int)>::fromCallable<WebKit::NetworkCache::IOChannel::write(unsigned long, WebKit::NetworkCache::Data const&, WTF::WorkQueue*, WTF::Function<void (int)>&&)::$_2>(WebKit::NetworkCache::IOChannel::write(unsigned long, WebKit::NetworkCache::Data const&, WTF::WorkQueue*, WTF::Function<void (int)>&&)::$_2)::'lambda'(void const*)::__invoke(void const*) + 24 (BlockPtr.h:77) 30 libsystem_blocks.dylib 0x00007fff57d1199d _Block_release + 111 31 libdispatch.dylib 0x00007fff57c8acd0 _dispatch_dispose + 61 32 libdispatch.dylib 0x00007fff57c915ca _dispatch_call_block_and_release + 12 33 libdispatch.dylib 0x00007fff57c89d88 _dispatch_client_callout + 8 34 libdispatch.dylib 0x00007fff57c9e209 _dispatch_queue_serial_drain + 635 35 libdispatch.dylib 0x00007fff57c91136 _dispatch_queue_invoke + 373 36 libdispatch.dylib 0x00007fff57c9eeff _dispatch_root_queue_drain_deferred_wlh + 332 37 libdispatch.dylib 0x00007fff57ca2d13 _dispatch_workloop_worker_thread + 880 38 libsystem_pthread.dylib 0x00007fff57fce033 _pthread_wqthread + 980 39 libsystem_pthread.dylib 0x00007fff57fcdc4d start_wqthread + 13
youenn fablet
Comment 7 2018-03-01 11:46:58 PST
youenn fablet
Comment 8 2018-03-01 11:55:58 PST
(In reply to youenn fablet from comment #7) > Created attachment 334832 [details] > Patch Updated CacheStorage::Engine::writeFile/readFile and it seems to fix the crash locally. If that is the real issue, I guess this could be fixed in IOChannel::read/IOChannel::write instead as a follow-up. I would need to dig further into dispatch_io_read/dispatch_io_write.
youenn fablet
Comment 9 2018-03-01 12:06:53 PST
EWS Watchlist
Comment 10 2018-03-01 13:16:18 PST
Comment on attachment 334836 [details] Patch Attachment 334836 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/6724372 New failing tests: http/tests/cache-storage/cache-clearing-origin.https.html http/tests/cache-storage/cache-clearing-all.https.html http/tests/cache-storage/cache-origins.https.html
EWS Watchlist
Comment 11 2018-03-01 13:16:20 PST
Created attachment 334844 [details] Archive of layout-test-results from ews104 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 12 2018-03-01 13:41:33 PST
Comment on attachment 334836 [details] Patch Attachment 334836 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/6724502 New failing tests: http/tests/cache-storage/cache-clearing-origin.https.html http/tests/cache-storage/cache-clearing-all.https.html http/tests/cache-storage/cache-origins.https.html
EWS Watchlist
Comment 13 2018-03-01 13:41:34 PST
Created attachment 334847 [details] Archive of layout-test-results from ews124 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews124 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
youenn fablet
Comment 14 2018-03-01 13:59:51 PST
WebKit Commit Bot
Comment 15 2018-03-01 15:19:12 PST
Comment on attachment 334851 [details] Patch Clearing flags on attachment: 334851 Committed r229151: <https://trac.webkit.org/changeset/229151>
WebKit Commit Bot
Comment 16 2018-03-01 15:19:14 PST
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 17 2018-03-02 08:25:13 PST
This is apparently not sufficient. Bots now also get some errors like: FAIL Service worker intercepts requests from window assert_equals: cache.add intercepted expected "intercepted" but got "cache match failed"
youenn fablet
Comment 18 2018-03-02 09:41:00 PST
Reopening to attach new patch.
youenn fablet
Comment 19 2018-03-02 09:41:01 PST
Created attachment 334902 [details] Further fix
WebKit Commit Bot
Comment 20 2018-03-02 14:10:21 PST
Comment on attachment 334902 [details] Further fix Clearing flags on attachment: 334902 Committed r229188: <https://trac.webkit.org/changeset/229188>
WebKit Commit Bot
Comment 21 2018-03-02 14:10:22 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.