Bug 211297

Summary: [iOS] ProcessThrottler fails to re-take ProcessAssertion if the previous one was invalidated
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, eric.carlson, ggaren, jer.noble, kevin.godell, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2020-05-01 09:53:57 PDT
Our ProcessAssertions may get invalidated upon backgrounding of the app. When the app becomes foreground and the ProcessThrottler tries to take a Foreground assertion as a result, it would incorrectly think it already had such assertion and not do anything, even though the previous one is no longer valid. As a result, the child processes would stay suspended even though the app was foregrounded.
Comment 1 Chris Dumez 2020-05-01 09:54:08 PDT
<rdar://problem/62542463>
Comment 2 Chris Dumez 2020-05-01 09:57:24 PDT
Created attachment 398194 [details]
Patch
Comment 3 Chris Dumez 2020-05-01 15:57:05 PDT
Comment on attachment 398194 [details]
Patch

Clearing flags on attachment: 398194

Committed r261034: <https://trac.webkit.org/changeset/261034>
Comment 4 Chris Dumez 2020-05-01 15:57:07 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Brent Fulgham 2020-05-01 15:59:59 PDT
Comment on attachment 398194 [details]
Patch

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

> Source/WebKit/ChangeLog:15
> +        To address the issue, add a isValid() method to ProcessAssertion() and check it in

"add an isValid() ..."

> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:462
> +    bool shouldHoldBackgroundTask = isValid() && type() != ProcessAssertionType::Suspended;

It seems like this might be the only use of validity(). Should it be removed?
Comment 6 Chris Dumez 2020-05-01 16:01:58 PDT
Comment on attachment 398194 [details]
Patch

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

> Source/WebKit/UIProcess/ProcessAssertion.h:-77
> -    Validity validity() const { return m_validity; }

See removal here.

>> Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm:462
>> +    bool shouldHoldBackgroundTask = isValid() && type() != ProcessAssertionType::Suspended;
> 
> It seems like this might be the only use of validity(). Should it be removed?

It was removed.