Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ede345f72045232e2a234574f3824cabd6bd1016
https://github.com/WebKit/WebKit/commit/ede345f72045232e2a234574f3824cabd6bd1016
Author: Rupin Mittal <[email protected]>
Date: 2024-11-15 (Fri, 15 Nov 2024)
Changed paths:
M Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm
Log Message:
-----------
Fix flaky failure of
TestWebKitAPI.ServiceWorkers.CacheStorageNetworkProcessCrash
https://bugs.webkit.org/show_bug.cgi?id=280208
rdar://136529803
Reviewed by Youenn Fablet and Sihui Liu.
The API test TestWebKitAPI.ServiceWorkers.CacheStorageNetworkProcessCrash
attempts to:
1. Create a cache
2. Terminate the network process
3. Check that trying to use the cache results in an error (indicating that
the cache was invalidated since the network process it was attached to
has been terminated).
The problem is that the call to use the cache in step 3 (DOMCache::match)
goes through the web process (WebCacheStorageConnection). But the call
to terminate the network process doesn't immediately notify the web process
that the network process has been terminated (its async). So if the call to
use the cache happens before the web process is aware, the call will try to
use the old network process, eventually realize that this is invalid, and
fail with an internal error.
So there is an inherent race condition.
The old test tried to get around this by first trying to open caches,
hoping that the web process would be notified of the network process'
termination at some point within these calls and then match could be tested
as expected. But it didn't handle the internal error that flakily occurs
as described above.
So we add the proper error handling--if a call to open() fails, we just
retry instead of causing the test to fail.
Additionally, we have a limit of 10 calls to open() so that the test
does not keep trying until timeout. If none of these 10 calls succeed
(which is possible given the race-condition), the test will be flaky again
and we'll need to increase the number of calls. (10 seems appropriate
for now given that the test usually takes only 1 or 2 to pass locally.)
Once a call to open() succeeds, we know that the web process has realized
the network process was terminated and has opened a new connection to a new
network process. Then, we make the call to use the original cache and check
if it is invalid.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
((ServiceWorkers, CacheStorageNetworkProcessCrash)):
((ServiceWorkers, DISABLED_CacheStorageNetworkProcessCrash)(ServiceWorkers,
CacheStorageNetworkProcessCrash)): Deleted.
Canonical link: https://commits.webkit.org/286678@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes