RESOLVED FIXED 211207
REGRESSION(r260791) Network process fails to suspend promptly
https://bugs.webkit.org/show_bug.cgi?id=211207
Summary REGRESSION(r260791) Network process fails to suspend promptly
Chris Dumez
Reported 2020-04-29 14:33:40 PDT
Network process fails to suspend promptly because NetworkProcess::prepareToSuspend() does not call its completion handler. This issue is with this code and was caused by using the same WorkQueue for all ITP stores: """ forEachNetworkSession([&callbackAggregator](auto& networkSession) { if (auto* resourceLoadStatistics = networkSession.resourceLoadStatistics()) { if (!resourceLoadStatistics->isEphemeral()) { WTFLogAlways("CHRIS: resourceLoadStatistics::BEGIN"); resourceLoadStatistics->suspend([callbackAggregator] { WTFLogAlways("CHRIS: resourceLoadStatistics::END"); }); } } }); """ On first loop iteration, resourceLoadStatistics->suspend() hangs/suspends the WorkQueue so every follow-up iteration will hang when calling resourceLoadStatistics->suspend().
Attachments
Patch (7.22 KB, patch)
2020-04-29 15:35 PDT, Chris Dumez
no flags
Patch (7.27 KB, patch)
2020-04-29 16:00 PDT, Chris Dumez
no flags
Patch (14.71 KB, patch)
2020-04-29 16:59 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-04-29 15:03:42 PDT
Will try a static suspend() for the static WorkQueue, instead of suspending each ITP store individually.
Radar WebKit Bug Importer
Comment 2 2020-04-29 15:26:07 PDT
Chris Dumez
Comment 3 2020-04-29 15:35:49 PDT
Chris Dumez
Comment 4 2020-04-29 15:36:37 PDT
Comment on attachment 398002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398002&action=review > Source/WebKit/ChangeLog:12 > + Trying to write an API test for this. For now, I validated this manually.
Alex Christensen
Comment 5 2020-04-29 15:40:21 PDT
Comment on attachment 398002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398002&action=review > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:-1385 > - ASSERT(RunLoop::isMain() && !isEphemeral()); Why not keep the RunLoop::isMain() assertion?
Geoffrey Garen
Comment 6 2020-04-29 15:41:38 PDT
Why not just call the completion handler, if that was the bug?
Geoffrey Garen
Comment 7 2020-04-29 15:42:12 PDT
Comment on attachment 398002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398002&action=review > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:67 > +WebResourceLoadStatisticsStore::State WebResourceLoadStatisticsStore::suspendedState { WebResourceLoadStatisticsStore::State::Running }; > +Lock WebResourceLoadStatisticsStore::suspendedStateLock; > +Condition WebResourceLoadStatisticsStore::suspendedStateChangeCondition; Do these need to be globals instead of data members?
Alex Christensen
Comment 8 2020-04-29 15:43:35 PDT
They're static, so just as global as sharedStatisticsQueue
Chris Dumez
Comment 9 2020-04-29 16:00:19 PDT
Chris Dumez
Comment 10 2020-04-29 16:01:43 PDT
(In reply to Geoffrey Garen from comment #7) > Comment on attachment 398002 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=398002&action=review > > > Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:67 > > +WebResourceLoadStatisticsStore::State WebResourceLoadStatisticsStore::suspendedState { WebResourceLoadStatisticsStore::State::Running }; > > +Lock WebResourceLoadStatisticsStore::suspendedStateLock; > > +Condition WebResourceLoadStatisticsStore::suspendedStateChangeCondition; > > Do these need to be globals instead of data members? Could you clarify? They are global in that they are static. Would you like me to move those statics to the cpp?
Chris Dumez
Comment 11 2020-04-29 16:59:27 PDT
Chris Dumez
Comment 12 2020-04-29 16:59:42 PDT
I added an API test.
EWS
Comment 13 2020-04-29 17:50:07 PDT
Committed r260928: <https://trac.webkit.org/changeset/260928> All reviewed patches have been landed. Closing bug and clearing flags on attachment 398010 [details].
Note You need to log in before you can comment on or make changes to this bug.