Bug 198488

Summary: [iOS] Do not prevent app suspension for more than 20 seconds after getting backgrounded
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: REOPENED ---    
Severity: Normal CC: commit-queue, ews-watchlist, ggaren, jer.noble, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews105 for mac-highsierra-wk2
none
Patch
none
Patch none

Description Chris Dumez 2019-06-03 10:35:33 PDT
Do not prevent app suspension for more than 20 seconds after getting backgrounded on iOS. We do this by implementing our own expiration handler which notifies our child processes of their imminent suspension before ending the background task that was preventing suspension.
Comment 1 Chris Dumez 2019-06-03 10:36:12 PDT
<rdar://problem/50837208>
Comment 2 Chris Dumez 2019-06-03 10:39:30 PDT
Created attachment 371194 [details]
Patch
Comment 3 EWS Watchlist 2019-06-03 11:53:08 PDT
Comment on attachment 371194 [details]
Patch

Attachment 371194 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/12364580

New failing tests:
http/wpt/service-workers/service-worker-networkprocess-crash.html
Comment 4 EWS Watchlist 2019-06-03 11:53:09 PDT
Created attachment 371201 [details]
Archive of layout-test-results from ews105 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 5 Geoffrey Garen 2019-06-03 16:11:15 PDT
Comment on attachment 371194 [details]
Patch

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

r=me

> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:236
> +    [self _cancelPendingReleaseTask];
> +    [self _cancelTimeoutTask];

Naming inconsistency is a little annoying here. 

I think the right naming is probabaly

    _cancelPendingReleaseTask => _cancelReleaseTask
    _pendingReleaseTask => _releaseTask
    _pendingTimeoutTask => _timeoutTask
Comment 6 Chris Dumez 2019-06-03 16:20:53 PDT
Created attachment 371227 [details]
Patch
Comment 7 Chris Dumez 2019-06-03 16:46:20 PDT
Created attachment 371230 [details]
Patch
Comment 8 Chris Dumez 2019-06-03 18:28:46 PDT
Comment on attachment 371230 [details]
Patch

Clearing flags on attachment: 371230

Committed r246053: <https://trac.webkit.org/changeset/246053>
Comment 9 Chris Dumez 2019-06-03 18:28:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Jer Noble 2019-07-03 15:00:09 PDT
Rolled out r246053 for reason:

This changeset caused media playback when the hosting application is backgrounded to break.

Committed r247109: <https://trac.webkit.org/changeset/247109/webkit>
Comment 11 Ryosuke Niwa 2019-08-22 16:58:48 PDT
Was this ever fixed some other way?