Bug 189632 - Clear pending resource load statistics' writes after tests
Summary: Clear pending resource load statistics' writes after tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Woodrow Wang
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-09-14 14:19 PDT by Woodrow Wang
Modified: 2018-09-17 10:28 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.45 KB, patch)
2018-09-14 14:35 PDT, Woodrow Wang
cdumez: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews202 for win-future (12.92 MB, application/zip)
2018-09-14 17:17 PDT, EWS Watchlist
no flags Details
Patch (2.44 KB, patch)
2018-09-14 17:33 PDT, Woodrow Wang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Woodrow Wang 2018-09-14 14:19:52 PDT
As of now, pending notifications from the resource load observer are not cleared at the conclusion of tests, which can lead to possible bugs where a pending write unintentionally persists into a subsequent test, leading to unexpected results. This is also a speculative fix for the flakiness in the tests here: https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=http%2Ftests%2FwebAPIStatistics%2Fnavigator-functions-accessed-data-collection.html%20http%2Ftests%2FwebAPIStatistics%2Fcanvas-read-and-write-data-collection.html%20http%2Ftests%2FwebAPIStatistics%2Ffont-load-data-collection.html%20http%2Ftests%2FwebAPIStatistics%2Fscreen-functions-accessed-data-collection.html 

Regardless of whether or not the flakiness is fixed by this patch, it would be good for and pending writes to be cleared in when resetting the statistics to a consistent state.
Comment 1 Radar WebKit Bug Importer 2018-09-14 14:30:16 PDT
<rdar://problem/44469275>
Comment 2 Woodrow Wang 2018-09-14 14:35:27 PDT
Created attachment 349808 [details]
Patch
Comment 3 John Wilander 2018-09-14 14:40:54 PDT
Looks good to me. ;)
Comment 4 Chris Dumez 2018-09-14 15:51:43 PDT
Comment on attachment 349808 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349808&action=review

> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:479
> +    statisticsStore->scheduleClearInMemory([callbackAggregator = callbackAggregator.copyRef()] { });

Why does this only clear memory data but not persistent one?
Comment 5 Woodrow Wang 2018-09-14 16:19:27 PDT
(In reply to Chris Dumez from comment #4)
> Comment on attachment 349808 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=349808&action=review
> 
> > Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:479
> > +    statisticsStore->scheduleClearInMemory([callbackAggregator = callbackAggregator.copyRef()] { });
> 
> Why does this only clear memory data but not persistent one?
It would be nice to clear the persistent storage between tests, but I am currently investigating if there might be any additional race conditions added simply by replacing the call to scheduleClearInMemory() to scheduleClearInMemoryAndPersistent(). Particularly, is it possible right now that the completion handler for scheduleClearInMemoryAndPersistent() could be called before the memory store has been cleared?
Comment 6 EWS Watchlist 2018-09-14 17:16:50 PDT
Comment on attachment 349808 [details]
Patch

Attachment 349808 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/9221897

New failing tests:
http/tests/misc/resource-timing-resolution.html
Comment 7 EWS Watchlist 2018-09-14 17:17:02 PDT
Created attachment 349833 [details]
Archive of layout-test-results from ews202 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews202  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 8 Woodrow Wang 2018-09-14 17:33:26 PDT
Created attachment 349837 [details]
Patch
Comment 9 WebKit Commit Bot 2018-09-17 10:18:36 PDT
Comment on attachment 349837 [details]
Patch

Clearing flags on attachment: 349837

Committed r236071: <https://trac.webkit.org/changeset/236071>