Closed Bug 1068826 Opened 10 years ago Closed 10 years ago

[Flame][KK]Upon booting for first time, there are extra processes in the memory, possbly slowing the performance

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-v2.0 affected, b2g-v2.1 verified, b2g-v2.2 verified)

VERIFIED FIXED
2.1 S5 (26sep)
Tracking Status
b2g-v2.0 --- affected
b2g-v2.1 --- verified
b2g-v2.2 --- verified

People

(Reporter: njpark, Assigned: crdlc)

Details

(Whiteboard: [systemsfe])

Attachments

(1 file)

STR:
Flash a new build to the flame device. (for example, from here: https://pvtbuilds.mozilla.org/pvt/mozilla.org/b2gotoro/tinderbox-builds/mozilla-central-flame-kk-eng/latest/)
connect the phone via USB, and send command 'adb shell b2g-ps'
Expected:
No Browser process, no Operatorvariant (at least after FTE), and only one homescreen process.
Actual:
APPLICATION    SEC USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
b2g              0 root      208   1     236276 68544 ffffffff b6ef5894 S /system/b2g/b2g
(Nuwa)           0 root      396   208   71576  7800  ffffffff b6ef5894 S /system/b2g/b2g
OperatorVariant  2 u0_a900   900   396   80192  12868 ffffffff b6ef5894 S /system/b2g/b2g
Browser          2 u0_a1002  1002  208   88664  11424 ffffffff b6f41894 S /system/b2g/plugin-container
Homescreen       2 u0_a1073  1073  208   146536 32144 ffffffff b6ef1894 S /system/b2g/plugin-container
Smart Collectio  2 u0_a1095  1095  208   94944  22516 ffffffff b6f3f894 S /system/b2g/plugin-container
Homescreen       2 u0_a1100  1100  208   89432  15708 ffffffff b6e68894 S /system/b2g/plugin-container
(Preallocated a  2 u0_a1102  1102  396   80160  16692 ffffffff b6ef5894 S /system/b2g/b2g

Note:
When the phone is restarted, those 3 processes are gone from memory.

We suspect this might be the reason why the app performance is poor upon flashing a new build, but improves when the phone is rebooted.

According to qDot, Operatorvariant applies variants to the system- only runs once on first boot.

Version Info:
Gaia      50666fa8bbbf3d346faff24f92ad8140a44a49d0
Gecko     https://hg.mozilla.org/mozilla-central/rev/8252eae8278c
BuildID   20140916170759
Version   35.0a1
Device Name 	 flame
FW-Release 	 4.4.2
FW-Incremental 	 eng.cltbld.20140916.201924
FW-Date 	 Tue Sep 16 20:19:35 EDT 2014
Bootloader 	 L1TC10011800

This also reproduces in 2.1.  The browser process isn't in memory, but homescreen and OperatorVariant is there after FTU is completed.
Gaia      47939f4c41d0c941e5047e5d1af74a79b7d8e0d5
Gecko     https://hg.mozilla.org/releases/mozilla-aurora/rev/c7477d4b33e7
BuildID   20140917083257
Version   34.0a2
Device Name 	 flame
FW-Release 	 4.4.2
FW-Incremental 	 eng.cltbld.20140917.124840
FW-Date 	 Wed Sep 17 12:48:56 EDT 2014
Bootloader 	 L1TC10011800
[Blocking Requested - why for this release]:
blocking-b2g: --- → 2.1?
Blocking requested since the unnecessary extra memory footprint (if it is determined to be unnecessary- having two homescreen process definitely seems so) will slow down the performance (at least on the first time use)
After rebooting the phone, b2g-ps shows this:
b2g              0 root      206   1     208824 77904 ffffffff b6eca894 S /system/b2g/b2g
(Nuwa)           0 root      369   206   54972  11352 ffffffff b6eca894 S /system/b2g/b2g
Homescreen       2 u0_a879   879   369   112752 30248 ffffffff b6eca894 S /system/b2g/b2g
Smart Collectio  2 u0_a1112  1112  206   75800  31372 ffffffff b6efa894 S /system/b2g/plugin-container
(Preallocated a  2 u0_a1135  1135  369   61168  16836 ffffffff b6eca894 S /system/b2g/b2g

Note that in the original STR, this command was run after completing the FTU experience.
QA Wanted to branch check against 2.0.
Keywords: qawanted
(In reply to Jason Smith [:jsmith] from comment #4)
> QA Wanted to branch check against 2.0.

In 2.0, the b2g-ps looks like the following:

APPLICATION    SEC USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
b2g              0 root      210   1     204964 89024 ffffffff b5acc3c4 R /system/b2g/b2g
(Nuwa)           0 root      891   210   55084  20272 ffffffff b6e778ac S /system/b2g/plugin-container
OperatorVariant  2 u0_a952   952   891   64424  20848 ffffffff b6e778ac S /system/b2g/plugin-container
Built-in Keyboa  2 u0_a1085  1085  210   78380  29040 ffffffff b6f3b8ac S /system/b2g/plugin-container
Homescreen       2 u0_a1126  1126  210   128148 43908 ffffffff b6ed38ac S /system/b2g/plugin-container
Smart Collectio  2 u0_a1128  1128  210   71492  28448 ffffffff b6f068ac S /system/b2g/plugin-container
Homescreen       2 u0_a1129  1129  210   71428  28416 ffffffff b6f4f8ac S /system/b2g/plugin-container
(Preallocated a  2 u0_a1136  1136  891   61288  18804 ffffffff b6e778ac S /system/b2g/plugin-container

-------

There is NO browser process and only one Homescreen process, BUT OperatorVariant process is present.

Tested on:
Device: Flame
BuildID: 20140917073857
Gaia: 31434a3949556171f3565ca47ac2b44e810e95e6
Gecko: e02fe140c0d5
Version: 32.0 (2.0)
Firmware: v165
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(jmitchell)
Keywords: qawanted
We need them to perform a version upgrade. Kevin, Kyle, can you confirm? This is first-time only after upgrade so I don't see why we should block here.
Flags: needinfo?(kyle)
Flags: needinfo?(kgrandon)
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmitchell)
I know nothing about homescreen migration. Pretty sure that was crdlc. ni?'ing.

That said, now that we have the migration system in place, if all this involves is IDBs, we /could/ look at doing something similar to browser's copy, but it might be a bit late in that particular game for a 2.1 landing.
Flags: needinfo?(kyle) → needinfo?(crdlc)
Is comment 5 implying this is or isn't a regression?
Flags: needinfo?(jmitchell)
(In reply to Jason Smith [:jsmith] from comment #9)
> Is comment 5 implying this is or isn't a regression?

The tester did not see the 2nd homescreen process - so this bug DOES fully repro in 2.0
so this does not appear to be a regression
Flags: needinfo?(jmitchell)
The homescreen boots up because we need to do some data migration from it. I believe both bookmarks and smart collections, though this can go away in 2.2.

We should be able to close the homescreen after migration. Wouldn't the oom killer kill the old homescreen if needed? In any case, I think that we should be able to do a window.close() after migration to close the old homescreen. I don't think we should block if this is the same as 2.0.
Flags: needinfo?(kgrandon)
I am following Kevin's approach
Assignee: nobody → crdlc
Status: NEW → ASSIGNED
Flags: needinfo?(crdlc)
Attached file Github pull request
Thanks
Attachment #8491281 - Flags: review?(kgrandon)
Comment on attachment 8491281 [details]
Github pull request

This should fix the home screen. I'm not sure if we need to also fix OperatorVariant and smart collections though.
Attachment #8491281 - Flags: review?(kgrandon) → review+
I see that you updated collections, this should work. It would be good to verify it real quick. (It's a bit late here and I'm about to sleep)
no idea about OperatorVariant, asking to Albert just in case he knows
Flags: needinfo?(alberto.crespellperez)
Same fix for OperatorVariant (window.close) is more complex because there are several flows and a lot of async processes, we have 16 async customizers, so we should add a lot of 'window.close' and implement some kind of queue in order to be able to track each customizer and close the when all of them finish.
Flags: needinfo?(alberto.crespellperez)
Merged in master:

https://github.com/mozilla-b2g/gaia/commit/d1fdc36498ecc961fbc5fd0f38e85b9ee1132441
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Thanks for the quick fix Cristian! Not blocking on it but please request uplift approval. 
no-jun, can you test the patch?
blocking-b2g: 2.1? → ---
Flags: needinfo?(npark)
Whiteboard: [systemsfe]
Comment on attachment 8491281 [details]
Github pull request

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #):
[User impact] if declined: The patch forces once those tasks are finished to be closed via window.close(). FTE is executed slower
[Testing completed]: added unit tests
[Risk to taking this patch] (and alternatives if risky):
[String changes made]: no
Attachment #8491281 - Flags: approval-gaia-v2.1?
This was merged to the master so I locally built the tip of the gaia branch to test it out.  (make reset-gaia) Extra Homescreen is now gone, and OperatorVariant and Browser is still present.  (Assuming the patch was only to kill extra Homescreen) The device functioned normally as well.

APPLICATION    SEC USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
b2g              0 root      5244  1     239388 72248 ffffffff b6eaa894 S /system/b2g/b2g
(Nuwa)           0 root      5248  5244  71572  8556  ffffffff b6eaa894 S /system/b2g/b2g
OperatorVariant  2 u0_a5339  5339  5248  79932  16264 ffffffff b6eaa894 S /system/b2g/b2g
Browser          2 u0_a5449  5449  5244  87380  15760 ffffffff b6eb3894 S /system/b2g/plugin-container
Homescreen       2 u0_a5594  5594  5244  140624 38524 ffffffff b6e88894 S /system/b2g/plugin-container
Smart Collectio  2 u0_a5729  5729  5248  83944  22472 ffffffff b6eaa894 S /system/b2g/b2g
(Preallocated a  2 u0_a5871  5871  5248  79836  17724 ffffffff b6eaa894 S /system/b2g/b2g
Flags: needinfo?(npark)
So about the browser and OperatorVariant process, are they actual bugs?  If so, should I open a separate bug to track them?
Attachment #8491281 - Flags: approval-gaia-v2.1? → approval-gaia-v2.1+
(In reply to No-Jun Park [:njpark] from comment #21)
> This was merged to the master so I locally built the tip of the gaia branch
> to test it out.  (make reset-gaia) Extra Homescreen is now gone, and
> OperatorVariant and Browser is still present.  (Assuming the patch was only
> to kill extra Homescreen) The device functioned normally as well.
> 
> APPLICATION    SEC USER     PID   PPID  VSIZE  RSS     WCHAN    PC        
> NAME
> b2g              0 root      5244  1     239388 72248 ffffffff b6eaa894 S
> /system/b2g/b2g
> (Nuwa)           0 root      5248  5244  71572  8556  ffffffff b6eaa894 S
> /system/b2g/b2g
> OperatorVariant  2 u0_a5339  5339  5248  79932  16264 ffffffff b6eaa894 S
> /system/b2g/b2g
> Browser          2 u0_a5449  5449  5244  87380  15760 ffffffff b6eb3894 S
> /system/b2g/plugin-container
> Homescreen       2 u0_a5594  5594  5244  140624 38524 ffffffff b6e88894 S
> /system/b2g/plugin-container
> Smart Collectio  2 u0_a5729  5729  5248  83944  22472 ffffffff b6eaa894 S
> /system/b2g/b2g
> (Preallocated a  2 u0_a5871  5871  5248  79836  17724 ffffffff b6eaa894 S
> /system/b2g/b2g

I checked with Fabrice, and this looks good.  Operator Variant is the FTU running, and Browser is just a iframe running someplace (maybe a notification?).   the fix removes both homescreen, so marking this bug as verified from your comment on tip.  please follow up and make sure this is also fixed on 2.1, and set status-b2g-2.1=verified when done.  thanks!
Status: RESOLVED → VERIFIED
Flags: needinfo?(npark)
(In reply to Tony Chung [:tchung] from comment #24)
> the fix removes both homescreen, so marking this bug as verified from your comment on tip. 

I meant the patch removes one of the migration homescreen processes, not both.
 In 2.1, extra homescreen process and browser process cannot be found.  Looks good.
APPLICATION    SEC USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
b2g              0 root      216   1     214536 67736 ffffffff b6e72894 S /system/b2g/b2g
(Nuwa)           0 root      408   216   54992  9228  ffffffff b6e72894 S /system/b2g/b2g
OperatorVariant  2 u0_a907   907   408   63300  14572 ffffffff b6e72894 S /system/b2g/b2g
Homescreen       2 u0_a1124  1124  216   130072 37136 ffffffff b6edb894 S /system/b2g/plugin-container
Smart Collectio  2 u0_a1181  1181  408   66628  22468 ffffffff b6e72894 S /system/b2g/b2g
(Preallocated a  2 u0_a1480  1480  408   61188  16936 ffffffff b6e72894 S /system/b2g/b2g
Flags: needinfo?(npark)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: