RESOLVED FIXED 160975
[iOS] Wait a few seconds before releasing network activity assertion after a load
https://bugs.webkit.org/show_bug.cgi?id=160975
Summary [iOS] Wait a few seconds before releasing network activity assertion after a ...
Chris Dumez
Reported 2016-08-18 14:31:30 PDT
Some apps do several loads one after the other in a non-visible view. This causes us to release the background assertion every time a load completes and then take one again less than a second after. Every time we release the assertion, we send a PrepareToSuspend IPC to the WebContent process, which does all the clean up to get ready to suspend, only to get a CancelPrepareReadyToSuspend later on because the next load has started. To work around this problem, we now wait a few seconds before releasing the background activity after a load.
Attachments
Patch (4.64 KB, patch)
2016-08-18 14:33 PDT, Chris Dumez
no flags
Patch (4.63 KB, patch)
2016-08-18 14:34 PDT, Chris Dumez
darin: review+
Chris Dumez
Comment 1 2016-08-18 14:31:44 PDT
Chris Dumez
Comment 2 2016-08-18 14:33:11 PDT
Chris Dumez
Comment 3 2016-08-18 14:34:11 PDT
Darin Adler
Comment 4 2016-08-20 19:08:49 PDT
Comment on attachment 286399 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=286399&action=review > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:828 > + RELEASE_LOG_IF(m_webView->_page->isAlwaysOnLoggingAllowed(), "%p UIProcess is releasing a background assertion because a page load completed", this); Is there any concern about leaking object pointers into the log?
Darin Adler
Comment 5 2016-08-20 19:09:19 PDT
Comment on attachment 286399 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=286399&action=review > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:846 > + m_releaseActivityTimer.startOneShot(3s); It’s best to document the reason we chose three seconds here.
Keith Rollin
Comment 6 2016-08-21 19:59:37 PDT
(In reply to comment #4) > Is there any concern about leaking object pointers into the log? Not that we're aware of. We've submitted logging that contains object pointers for Data Collection Review and no one raised an issue.
Chris Dumez
Comment 7 2016-08-22 08:41:27 PDT
Darin Adler
Comment 8 2016-08-24 10:10:00 PDT
Comment on attachment 286399 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=286399&action=review >> Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:846 >> + m_releaseActivityTimer.startOneShot(3s); > > It’s best to document the reason we chose three seconds here. Chris, the patch that you landed simply states the reason we are delaying, but sheds no light on why the delay is 3 seconds long as opposed to 1 second, 10 seconds, 100 seconds, or 100 ms.
Chris Dumez
Comment 9 2016-08-24 10:42:09 PDT
(In reply to comment #8) > Comment on attachment 286399 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=286399&action=review > > >> Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:846 > >> + m_releaseActivityTimer.startOneShot(3s); > > > > It’s best to document the reason we chose three seconds here. > > Chris, the patch that you landed simply states the reason we are delaying, > but sheds no light on why the delay is 3 seconds long as opposed to 1 > second, 10 seconds, 100 seconds, or 100 ms. I do not have a great explanation for this value. I wanted a value short enough that delaying suspension for this period of time would be acceptable (3 seconds seemed acceptable for me). I also wanted a value large enough to give the application a chance to do something before trying the suspend the process too aggressively. Also, this value worked for the Facebook App.
Darin Adler
Comment 10 2016-08-24 12:06:05 PDT
(In reply to comment #9) > I wanted a value short > enough that delaying suspension for this period of time would be acceptable > (3 seconds seemed acceptable for me). I also wanted a value large enough to > give the application a chance to do something before trying the suspend the > process too aggressively. Also, this value worked for the Facebook App. This is very close to the type of thing I wanted to see in the code. If someone wants to figure out later if this is the right value, this is the kind of information they need. I would like to know more about why delaying suspension for three seconds is acceptable. What makes this acceptable? What happens during those three seconds?
Note You need to log in before you can comment on or make changes to this bug.