Closed Bug 867739 Opened 11 years ago Closed 7 years ago

Somehow we get two preallocated app processes

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: justin.lebar+bug, Unassigned)

References

Details

(Whiteboard: [MemShrink:P2])

I don't know how this is happening, but somehow we get into a situation where
we have two preallocated app processes:

> $ adb shell b2g-procrank --oom
> 
> APPLICATION       OOM_ADJ  OOM_SCORE  OOM_SCORE_ADJ   PID      Vss      Rss      Pss      Uss  cmdline
> b2g                  0        284         0           144   67764K   57728K   50854K   48656K  /system/b2g/b2g
> Browser              6        599         400       18177   36656K   36576K   26276K   22988K  /system/b2g/plugin-container
> Homescreen           4        415         267       16303   27696K   27612K   17371K   14144K  /system/b2g/plugin-container
> (Preallocated a      2        241         134       16472   19800K   19708K   10842K    8364K  /system/b2g/plugin-container
> (Preallocated a      6        477         400       18088   19728K   19636K   10796K    8328K  /system/b2g/plugin-container
>                                                                               ------   ------  ------
>                                                                              124965K  110804K  TOTAL
> 
> /sys/module/lowmemorykiller/parameters/minfree:         1024,1280,1536,1792,2048,5120
> /sys/module/lowmemorykiller/parameters/adj:             0,1,2,3,4,6
> /sys/module/lowmemorykiller/parameters/notify_trigger:  2560

I've seen this twice now after using the browser to navigate to pinterest and
occasionally accidentally clicking on links there.  I can't reproduce this at
will yet.

Note that one of the preallocated processes has OOM_ADJ==2.  This gives is
foreground priority.  Because it's so small, real apps will always be killed
before this preallocated process dies.  In other words, this process is a
pretty serious memory leak.
Here's the logcat of one of these preallocated processes starting up.  It's not very informative.  After this, I never see its pid in logcat again.

> 05-01 15:55:22.269 I/Gonk    (  144): Changed nice for pid 16472 from 0 to 18.
> 05-01 15:55:22.709 I/DMD     (16472): $DMD = '1'
> 05-01 15:55:22.729 I/DMD     (16472): DMD is enabled
> 05-01 15:55:23.149 E/profiler(16472): Registering start signal
> 05-01 15:55:23.589 E/GeckoConsole(16472): [JavaScript Warning: "Unknown property '-moz-align-self'.  Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}]
> 05-01 15:55:23.859 I/Gecko   (16472): ###################################### forms.js loaded
> 05-01 15:55:23.879 I/Gecko   (16472): ############################### browserElementPanning.js loaded
> 05-01 15:55:24.449 I/Gecko   (16472): ######################## BrowserElementChildPreload.js loaded
> 05-01 15:56:25.869 I/Gonk    (  144): Changed nice for pid 16472 from 18 to 1.
It's like the first preallocated process was supposed to be some app, and then it either dies or hangs. 

The main process thinks it launched the app, so once things go idle again, it creates another preallocated process.

So I think we need to look at 16472 (the first preallocated process) and see what its doing.

It would also be useful to see the output of b2g-ps when this happens so we can double check that the process has the correct parent.
> It's like the first preallocated process was supposed to be some app, and then it either dies or 
> hangs.

That could be.  That's an easy enough hypothesis to test.

The parent looks fine to me:

> $ adb shell b2g-ps
> APPLICATION      USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
> b2g              root      144   112   182720 56920 ffffffff 400da430 S /system/b2g/b2g
> Homescreen       app_16303 16303 144   70300  26704 ffffffff 4010c430 S /system/b2g/plugin-container
> (Preallocated a  app_16472 16472 144   61820  19344 ffffffff 400dd430 S /system/b2g/plugin-container
> (Preallocated a  root      18088 144   61820  19300 ffffffff 40045430 S /system/b2g/plugin-container
> Browser          app_18177 18177 144   85540  35856 ffffffff 4005a430 S /system/b2g/plugin-container
> 05-01 17:15:03.079 I/Gecko   (  144): PreallocatedProcessManagerImpl::Take(null)
> 05-01 17:15:03.109 I/Gonk    (  144): Changed nice for pid 3489 from 0 to 1.
> 05-01 17:15:03.229 I/DMD     ( 3489): $DMD = '1'
> 05-01 17:15:03.229 I/DMD     ( 3489): DMD is enabled
> 05-01 17:15:04.169 E/profiler( 3489): Registering start signal
> 05-01 17:15:05.029 E/GeckoConsole( 3489): [JavaScript Warning: "Unknown property '-moz-align-self'.  Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}]
> 05-01 17:15:06.589 I/Gecko   ( 3489): ###################################### forms.js loaded
> 05-01 17:15:06.639 I/Gecko   ( 3489): ############################### browserElementPanning.js loaded
> 05-01 17:15:06.769 I/Gecko   ( 3489): ######################## BrowserElementChildPreload.js loaded

Pid 3489 is listed as a preallocated app process, but it looks like it's not actually; PreallocatedProcessManagerImpl::Take returned null and then it appears that we launched a new process.  Maybe the launch got hung up halfway through somehow.
I can't seem to reproduce this anymore, but maybe this is bug 859149.  I bet we could run into that bug with the pull-down notifications bar, which creates an <iframe mozbrowser> for the usage app.
Depends on: 859149
Whiteboard: [MemShrink] → [MemShrink:P2]
See Also: → 1051745
See Also: → 1054011
Closing out old Firefox OS specific memshrink bugs.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.