Closed Bug 1625326 Opened 5 years ago Closed 4 years ago

Figure out prioritization levels for non-content processes

Categories

(GeckoView Graveyard :: Sandboxing, task, P1)

Unspecified
Android

Tracking

(firefox78 fixed)

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

(Whiteboard: [geckoview:m78])

Attachments

(1 file)

Per discussion at https://phabricator.services.mozilla.com/D68419#inline-405631:

if we go to the background we probably care more about the main process staying alive that the media process or the socket process (when it will be enabled).

ie we need to determine how/what to do with those processes priorities.

Whiteboard: [geckoview:m77]
Assignee: nobody → aklotz
Priority: -- → P1
Whiteboard: [geckoview:m77] → [geckoview:m78]

I think that the status-quo of non-content processes always receiving foreground is fine. When the parent goes background, Android sends its bound child processes to the background along with it.

Maybe the only exception to that would be if we wanted to be clever with respect to the extension process. As a hypothetical example, suppose the user has installed an extension that is restricted to specific origins. Perhaps we don't boost the extension process's priority to foreground unless there are content process(es) corresponding to those origins are in the foreground.

I think I'm going to resolve this as WORKSFORME for now.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME

Ah, or maybe we want to do something about relative priority so that, as mentioned in the description, other processes are terminated before the main process is.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---

Gecko's process priority manager works exclusively with content processes, so that is not particularly useful here.

Probably the best way for us to handle this is 100% at the Java layer, using the proper lifecycle callbacks to adjust the non-content process priority.

Status: REOPENED → ASSIGNED

Hmm, maybe we can also alter the socket process's priority depending on the state of network connectivity.

  • We attach a native counterpart to ths GeckoProcessManager.ConnectionManager
    instance that listens for app foreground, app background, and when the
    socket process is enabled, network state events.
  • On app background, all non-content processes are assigned BACKGROUND priority.
    Even though backgrounding the app will cause Android to drop all child
    processes' priority regardless of our priority settings, we still do this as
    to indicate to Android that these processes are relatively less important
    than our parent process.
  • When the socket process is enabled, we drop its priority when we detect that
    we have no network connectivity. Note that the network management code does
    the Right Thing if network connectivity changes while our app was in the
    background: we receive the network state change event once we return to
    foreground, therefore we do not need to do any special handling ourselves.
Attachment #9146912 - Attachment description: Bug 1625326: Add priority managment for non-content child processes to GeckoProcessManager; r=#geckoview-reviewers → Bug 1625326: Add priority management for non-content child processes to GeckoProcessManager; r=#geckoview-reviewers
See Also: → 1639356
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/06b7037addb5
Add priority management for non-content child processes to GeckoProcessManager; r=geckoview-reviewers,agi
Status: ASSIGNED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78

Moving content process management bugs to the new GeckoView::Sandboxing component.

Component: General → Sandboxing
Product: GeckoView → GeckoView Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: