Bug 268799 - hideContentUntilPendingUpdate async IPC call during backgrounding blocks process suspension
Summary: hideContentUntilPendingUpdate async IPC call during backgrounding blocks proc...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ben Nham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-02-05 21:01 PST by Ben Nham
Modified: 2024-02-06 10:52 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Nham 2024-02-05 21:01:10 PST
On iOS, when the UIProcess goes into the background, it eventually calls in to hideContentUntilPendingUpdate through this call stack:

  WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate()
  WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground()
  WebKit::ApplicationStateTracker::didCompleteSnapshotSequence()

The problem is that we recently added an async DrawingArea::DispatchAfterEnsuringDrawing IPC with reply handler call to hideContentUntilPendingUpdate (see 269776@main, 270672@main, and 271260@main). An async IPC with a reply handler in the UIProcess implicitly takes out a background activity which prevents the WebContent process (and also the UIProcess) from suspending until the reply handler runs. Unfortunately, since the WebContent process is in the background, presumably it doesn't render, so the DispatchAfterEnsuringDrawing reply handler doesn't even run and we basically end up blocking process suspension entirely until the 15 second timer in ProcessStateMonitor expires and forcefully cancels all background activities for all processes.

We need to fix this by reworking the logic somehow or by making this DispatchAfterEnsuringDrawing IPC not create a background activity.
Comment 1 Ben Nham 2024-02-05 21:01:26 PST
rdar://121185956
Comment 2 Ben Nham 2024-02-05 21:12:29 PST
Pull request: https://github.com/WebKit/WebKit/pull/23900
Comment 3 EWS 2024-02-06 10:51:58 PST
Committed 274157@main (f4ce57789de5): <https://commits.webkit.org/274157@main>

Reviewed commits have been landed. Closing PR #23900 and removing active labels.