Summary: | Make WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() call WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed() in a proper callback | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Matt Lewis <jlewis3> | ||||||
Component: | New Bugs | Assignee: | John Wilander <wilander> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | bfulgham, commit-queue, jlewis3, ryanhaddad, webkit-bug-importer, wilander | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
See Also: |
https://bugs.webkit.org/show_bug.cgi?id=182624 https://bugs.webkit.org/show_bug.cgi?id=183024 |
||||||||
Attachments: |
|
Description
Matt Lewis
2018-02-12 16:09:45 PST
Marked as flaky in: https://trac.webkit.org/changeset/228403/webkit Created attachment 333988 [details]
Patch
Comment on attachment 333988 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333988&action=review I think this is close, but not quite right. r- to move the last few steps of the method inside the completion handlers. > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:282 > + pruneStatisticsIfNeeded(); Shouldn't "pruneStatisticsIfNeeded()" and "m_persistentStorage.scheduleOrWriteMemoryStore" be part of the completion handler? I think part of the flakiness is that 'removeDataRecords' can take time to complete (hopping from work queue, to main thread, to work queue, to main thread). I think after this patch, removeDataRecords will be called at the expected time now, but that 'pruneStatisticsIfNeeded' might run before removeDataRecords completes (since removeDataRecords hops to the main thread before doing the delete, which might allow the work queue to return and call 'pruneStatisticsIfNeeded' before the deletes happen. Likewise, I don't think we want to schedule the write of the in-memory store until these bits of work are finished, so they should be inside the completion handler, too. (In reply to Brent Fulgham from comment #4) > Comment on attachment 333988 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=333988&action=review > > I think this is close, but not quite right. r- to move the last few steps of > the method inside the completion handlers. > > > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:282 > > + pruneStatisticsIfNeeded(); > > Shouldn't "pruneStatisticsIfNeeded()" and > "m_persistentStorage.scheduleOrWriteMemoryStore" be part of the completion > handler? > > I think part of the flakiness is that 'removeDataRecords' can take time to > complete (hopping from work queue, to main thread, to work queue, to main > thread). I think after this patch, removeDataRecords will be called at the > expected time now, but that 'pruneStatisticsIfNeeded' might run before > removeDataRecords completes (since removeDataRecords hops to the main thread > before doing the delete, which might allow the work queue to return and call > 'pruneStatisticsIfNeeded' before the deletes happen. > > Likewise, I don't think we want to schedule the write of the in-memory store > until these bits of work are finished, so they should be inside the > completion handler, too. Thanks, Brent! I was thinking along those lines too but would you be fine landing this as a first step? The benefit would be to address the flakiness that’s hitting the bots. Comment on attachment 333988 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333988&action=review >>> Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:282 >>> + pruneStatisticsIfNeeded(); >> >> Shouldn't "pruneStatisticsIfNeeded()" and "m_persistentStorage.scheduleOrWriteMemoryStore" be part of the completion handler? >> >> I think part of the flakiness is that 'removeDataRecords' can take time to complete (hopping from work queue, to main thread, to work queue, to main thread). I think after this patch, removeDataRecords will be called at the expected time now, but that 'pruneStatisticsIfNeeded' might run before removeDataRecords completes (since removeDataRecords hops to the main thread before doing the delete, which might allow the work queue to return and call 'pruneStatisticsIfNeeded' before the deletes happen. >> >> Likewise, I don't think we want to schedule the write of the in-memory store until these bits of work are finished, so they should be inside the completion handler, too. > > Thanks, Brent! I was thinking along those lines too but would you be fine landing this as a first step? The benefit would be to address the flakiness that’s hitting the bots. No -- the change I'm asking for would only be copying two lines and adding them to the two completion handlers here. I guess you'll need to capture 'this' and so forth, but it's not a big change. I think that should be done as part of this patch. Created attachment 334165 [details]
Patch
Sorry for the delay in updating the patch. I was out for a conference. Comment on attachment 334165 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334165&action=review r=me. Thanks for being patient with these changes! > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:291 > + } Great! I think that's what we needed. Comment on attachment 334165 [details]
Patch
Thanks, Brent!
Comment on attachment 334165 [details] Patch Clearing flags on attachment: 334165 Committed r228828: <https://trac.webkit.org/changeset/228828> All reviewed patches have been landed. Closing bug. Added a delay in the test case to see if that stabilizes it. https://bugs.webkit.org/show_bug.cgi?id=183024 |