Closed Bug 968297 Opened 10 years ago Closed 10 years ago

Nuwa causes the process priority manager to miscompute priorities for applications in the foreground

Categories

(Core :: IPC, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30
blocking-b2g 1.3+
Tracking Status
b2g18 --- unaffected
b2g-v1.1hd --- unaffected
b2g-v1.2 --- unaffected
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: gsvelto, Assigned: gsvelto)

References

Details

Attachments

(1 file, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #950266 +++

While testing an unrelated bug I've noticed that after Nuwa has been re-enabled the priorities of foreground applications where completely wrong. You can check the issue with the following STR:

- Launch an application

- Send it into the background

- Run adb shell /system/bin/b2g-info, you should get something like this for the application (the application has foreground priority, nice == 18):

           NAME  TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
 Communications 2269   18  8.4 11.3 25.8  72.0       2 app_2269

- Bring the application back in the foreground and run b2g-info again, you should get this (the application has foreground priority, nice == 1)

           NAME  TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
 Communications 2269    1  8.4 11.3 25.8  72.0       2 app_2269

  Instead you will still get background priority for the app:

           NAME  TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
 Communications 2269   18  8.4 11.3 25.8  72.0       2 app_2269

A quick investigation shows that the |mHighPriorityChildIDs| in the ProcessPriorityManagerImpl contains a stray element: this causes the process priority manager to think that there's an high priority process present which in turn forces everybody else into low priorities.
This will likely cause the foreground app to get killed more often as we start running low on memory (which we do a lot). So I'd say this is a blocker.
blocking-b2g: --- → 1.3?
blocking-b2g: 1.3? → 1.3+
Blocks: Nuwa
Nuwa is the process left in mHighPriorityChildIDs. I don't think Nuwa should be put in mHighPriorityChildIDs, its priority is decided once it is ready.
Attachment #8371251 - Flags: review?(khuey)
Attachment #8371251 - Flags: feedback?(cyu)
Comment on attachment 8371251 [details] [diff] [review]
Don't add Nuwa process to mHighPriorityChildIDs

Looks good to me.
Attachment #8371251 - Flags: feedback?(cyu) → feedback+
Taking this bug since I'm already familiar with the code. The proposed patch does fixes the issue at hand but introduces another problem because we're still notifying the parent process that the child priority has changed.

This patch prevents priority changes to the Nuwa process entirely instead. A cleaner approach would be to implement a Nuwa-specific ParticularProcessPriorityManager that would contain only empty stubs for all non-required methods but since this is a 1.3+ bug let's keep it simple.
Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Attachment #8371653 - Flags: review?(khuey)
See Also: → 915138
Attachment #8371251 - Attachment is obsolete: true
Try run is here https://tbpl.mozilla.org/?tree=Try&rev=9b732b3ecf8d

The patch applies cleanly to mozilla-b2g28_v1_3
Keywords: checkin-needed
Gabriele, I'm seeing Nuwa get OOM killed on mozilla-central as of last night.  Is this possibly related to your work in process priority manager?  See bug 969224.
See Also: → 969224
Oops.  Must not be since you haven't landed anything yet.  Seems like it might be related, though.
(In reply to Ben Kelly [:bkelly] from comment #7)
> Gabriele, I'm seeing Nuwa get OOM killed on mozilla-central as of last
> night.  Is this possibly related to your work in process priority manager? 
> See bug 969224.

It can be related to the bug I fixed here. Without my patch it is possible that the Nuwa process' priority gets adjusted; if it's sent into the background there's good chances it will be killed due to OOM in low-memory conditions.
Blocks: 969224
See Also: 969224
https://hg.mozilla.org/mozilla-central/rev/32e2494ae624
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
No longer blocks: 969224
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: