Bug 208700 - Make ProcessThrottler::sendPrepareToSuspendIPC more robust to send failures
Summary: Make ProcessThrottler::sendPrepareToSuspendIPC more robust to send failures
Status: RESOLVED DUPLICATE of bug 208701
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-06 01:39 PST by youenn fablet
Modified: 2020-03-06 09:33 PST (History)
3 users (show)

See Also:


Attachments
Patch (3.60 KB, patch)
2020-03-06 01:42 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2020-03-06 01:39:11 PST
Make ProcessThrottler::sendPrepareToSuspendIPC more robust to send failures
Comment 1 youenn fablet 2020-03-06 01:39:31 PST
<rdar://problem/59921309>
Comment 2 youenn fablet 2020-03-06 01:42:00 PST
Created attachment 392690 [details]
Patch
Comment 3 youenn fablet 2020-03-06 01:55:57 PST
An alternative (or a related fix) would be to ensure AuxiliaryProcessProxy::sendMessage is calling the completion handler asynchronously in case of error.
I do not think we loose much efficiency and this might get us safer.
Comment 4 youenn fablet 2020-03-06 02:02:55 PST
See https://bugs.webkit.org/show_bug.cgi?id=208701
Comment 5 Chris Dumez 2020-03-06 08:53:26 PST
Comment on attachment 392690 [details]
Patch

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

> Source/WebKit/UIProcess/ProcessThrottler.cpp:185
> +    setAssertionState(isSuspensionImminent == IsSuspensionImminent::Yes ? AssertionState::Suspended : AssertionState::Background);

I am some worries in cases where isSuspensionImminent is true. The previous code already seemed a bit risky but now it seems even riskier. We release the process assertion for the child process *before* even sending the async IPC. The odds of the child process receiving the prepareToSuspend IPC before suspending are not good :/

I am trying to think of a better solution.
Comment 6 youenn fablet 2020-03-06 09:02:10 PST
(In reply to Chris Dumez from comment #5)
> Comment on attachment 392690 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=392690&action=review
> 
> > Source/WebKit/UIProcess/ProcessThrottler.cpp:185
> > +    setAssertionState(isSuspensionImminent == IsSuspensionImminent::Yes ? AssertionState::Suspended : AssertionState::Background);
> 
> I am some worries in cases where isSuspensionImminent is true. The previous
> code already seemed a bit risky but now it seems even riskier. We release
> the process assertion for the child process *before* even sending the async
> IPC. The odds of the child process receiving the prepareToSuspend IPC before
> suspending are not good :/
> 
> I am trying to think of a better solution.

https://bugs.webkit.org/show_bug.cgi?id=208701 should fix the same issue as here by making sure to call the completion handler asynchronously.

As of Imminent==Yes, I am not sure how much this will change things in practice.
Comment 7 Chris Dumez 2020-03-06 09:08:10 PST
(In reply to youenn fablet from comment #6)
> (In reply to Chris Dumez from comment #5)
> > Comment on attachment 392690 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=392690&action=review
> > 
> > > Source/WebKit/UIProcess/ProcessThrottler.cpp:185
> > > +    setAssertionState(isSuspensionImminent == IsSuspensionImminent::Yes ? AssertionState::Suspended : AssertionState::Background);
> > 
> > I am some worries in cases where isSuspensionImminent is true. The previous
> > code already seemed a bit risky but now it seems even riskier. We release
> > the process assertion for the child process *before* even sending the async
> > IPC. The odds of the child process receiving the prepareToSuspend IPC before
> > suspending are not good :/
> > 
> > I am trying to think of a better solution.
> 
> https://bugs.webkit.org/show_bug.cgi?id=208701 should fix the same issue as
> here by making sure to call the completion handler asynchronously.
> 
> As of Imminent==Yes, I am not sure how much this will change things in
> practice.

I prefer the other patch, seems less risky.
Comment 8 youenn fablet 2020-03-06 09:33:40 PST

*** This bug has been marked as a duplicate of bug 208701 ***