High memory usage and apps gets killed more often because of multiple preallocate process on device .

RESOLVED FIXED in Firefox 34

Status

defect
P1
blocker
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: tkundu, Assigned: ting)

Tracking

({memory-footprint, perf})

unspecified
2.1 S3 (29aug)
ARM
Gonk (Firefox OS)
Dependency tree / graph

Firefox Tracking Flags

(blocking-b2g:2.0+, firefox32 wontfix, firefox33 wontfix, firefox34 fixed, b2g-v2.0 fixed, b2g-v2.1 fixed)

Details

(Whiteboard: [caf priority: p1][CR 713185][MemShrink])

Attachments

(5 attachments, 2 obsolete attachments)

STR: DO some random stability testing on device.

1) Device takes longer time to launch subsequent app and it becomes unresponsive temporarily at some point
2) Multiple preallocate process are created from NUWA process and it does not goes away even after device resumes normal operations
[Blocking Requested - why for this release]:
blocking-b2g: --- → 2.0?
gecko memory report from affected device
Flags: needinfo?(khuey)
Flags: needinfo?(erahm)
Component: Gaia → Performance
Keywords: footprint, perf
Whiteboard: [CR 713185] → [CR 713185][MemShrink]
Whiteboard: [CR 713185][MemShrink] → [caf priority: p1][CR 713185][MemShrink]
See Also: → 1056492
I'll take a look at this.
Assignee: nobody → tchou
Posted patch patch-b2gv2.0 (obsolete) — Splinter Review
Calling RunAfterPreallocatedProcessReady() in nsFrameLader::ReallyStartLoadingInternal() causes SendNuwaFork(), which is not needed as of bug 1033618 landing. If two applications are launched continuously when there's no preallocated process, there will be chances that Nuwa forks two preallocated processes and both are not used.

Kyle, I removed also RunAfterPreallocatedProcessReady() since it is not used in any other places, please let me know if I should recover it.

Tapas, could you please test the patch since there's no specific STR? I couldn't repro after applying the patch, but I am afraid maybe I just didn't trigger it.

The patch of bug 1033618 seems applied differently on trunk, I will make another patch for it later.
Attachment #8477249 - Flags: review?(khuey)
Flags: needinfo?(tkundu)
Comment on attachment 8477249 [details] [diff] [review]
patch-b2gv2.0

Removed duplicate review flag.
Attachment #8477249 - Flags: review?(khuey)
See Also: → 1051745
Posted patch patch-b2gv2.0 (obsolete) — Splinter Review
I just realized v2.0 is now on mozilla-beta, rebased.
Attachment #8477249 - Attachment is obsolete: true
Attachment #8477249 - Flags: review?(khuey)
Attachment #8477349 - Flags: review?(khuey)
Flags: needinfo?(erahm)
Confirmed with Tapas/Inder that they have picked the patch in review here and are trying to test it.
Posted file logs.zip
This is reproduced again with patch from attachment 8477349 [details] [diff] [review] .

UI is stuck and we are seeing multiple preallocate process. We have to wait for 2-3 mins so that preallocate apps are killed or converted to actual apps (Please see b2g-info logs).
Flags: needinfo?(tkundu)
Flags: needinfo?(tchou)
Can you elaborate "UI is stuck" and how was "2-3 mins" counted, does that mean you did nothing and wait 2-3 mins for preallocated processes to become apps?

From b2g-info logs, it seems you launch multiple applications simutaneously, so there could be some preallocated processes existed (forked and haven't changed to app), but I don't see two preallocated which do not go away as you reported originally?
Flags: needinfo?(tchou) → needinfo?(tkundu)
Also from b2g-info logs of attachment 8477349 [details] [diff] [review], I don't see more than one prallocated process is forked from Nuwa.
(In reply to Ting-Yu Chou [:ting] from comment #10)
> Can you elaborate "UI is stuck" and how was "2-3 mins" counted, does that
> mean you did nothing and wait 2-3 mins for preallocated processes to become
> apps?
> 
Yes. UI stuck means I am touching icons of multiple apps but it is taking to start those apps. 
And I have to wait 2-3 mins for preallicated processes to become apps.

> From b2g-info logs, it seems you launch multiple applications simutaneously,
> so there could be some preallocated processes existed (forked and haven't
> changed to app), but I don't see two preallocated which do not go away as
> you reported originally?

I am just touching multiple icons in homescreen as quickly as possible without closing any apps.
Flags: needinfo?(tkundu) → needinfo?(tchou)
Please correct me if I misunderstood.

So the "reproduced again" in comment 9 means you didn't see extra unused preallocated process forked from Nuwa but you saw preallocated processes transform to apps slowly when try to launch many apps at the same time?

2-3 mins is still too slow, is the test device a 319MB Flame? I couldn't reproduce that on mine.
Flags: needinfo?(tchou) → needinfo?(tkundu)
(In reply to Ting-Yu Chou [:ting] from comment #13)
> Please correct me if I misunderstood.
> 
> So the "reproduced again" in comment 9 means you didn't see extra unused
> preallocated process forked from Nuwa but you saw preallocated processes
> transform to apps slowly when try to launch many apps at the same time?
> 
> 2-3 mins is still too slow, is the test device a 319MB Flame? I couldn't
> reproduce that on mine.

ting, the CAF testing is based on a 256MB QRD 8x10 hardware.
blocking-b2g: 2.0? → 2.0+
(In reply to Ting-Yu Chou [:ting] from comment #13)
> Please correct me if I misunderstood.
> 
> So the "reproduced again" in comment 9 means you didn't see extra unused
> preallocated process forked from Nuwa but you saw preallocated processes
> transform to apps slowly when try to launch many apps at the same time?
> 
Yes . You are right.
Flags: needinfo?(tkundu) → needinfo?(tchou)
(In reply to Tapas  (always NI me) from comment #0)
> 2) Multiple preallocate process are created from NUWA process and it does
> not goes away even after device resumes normal operations

The patch (attachment 8477439 [details] [diff] [review]) is to adress this, which from your attachment 8476966 [details] there's an extra unused preallocated process from Nuwa:

           NAME   PID PPID CPU(s) NICE  USS  PSS  RSS SWAP VSIZE OOM_ADJ USER     
            b2g   231    1  155.8    0 36.2 38.3 43.7 14.4 243.4       0 root     
         (Nuwa)   983  231    2.4    0  0.0  0.0  0.4  7.8  53.8       0 root     
     Homescreen  1019  983   35.4    1  1.2  2.2  5.6 15.5  79.0       2 u0_a1019 
(Preallocated a 24939  983    1.6   18  0.0  0.2  1.4 10.1  60.9       1 u0_a24939
     QcSettings 24949  231    2.8   18  7.6  9.9 15.5  3.5  67.9      11 u0_a24949
     HelloWorld 24968  231    2.5   18  6.4  8.5 14.0  3.9  67.9      10 u0_a24968
(Preallocated a 25004  983    1.3   18  0.0  0.2  1.3 10.1  60.9       1 u0_a25004

Tapas, then what is the expected result of this bug?
Flags: needinfo?(tchou) → needinfo?(tkundu)
(In reply to Ting-Yu Chou [:ting] from comment #16)
> (In reply to Tapas  (always NI me) from comment #0)
> > 2) Multiple preallocate process are created from NUWA process and it does
> > not goes away even after device resumes normal operations
> 
> The patch (attachment 8477439 [details] [diff] [review]) is to adress this,

I meant attachment 8477349 [details] [diff] [review].
(In reply to Ting-Yu Chou [:ting] from comment #17)
> (In reply to Ting-Yu Chou [:ting] from comment #16)
> > (In reply to Tapas  (always NI me) from comment #0)
> > > 2) Multiple preallocate process are created from NUWA process and it does
> > > not goes away even after device resumes normal operations
> > 
> > The patch (attachment 8477439 [details] [diff] [review]) is to adress this,
> 
> I meant attachment 8477349 [details] [diff] [review].

Yes this issue is fixed with this patch. I also agree.

I will raise separate bug for my comment 9. 


Please go ahead and land your fix in v2.0
Flags: needinfo?(tkundu) → needinfo?(tchou)
OK, thank you.
Flags: needinfo?(tchou)
Can you summarize comments 9-18 for me so I can review this quickly tomorrow?
Flags: needinfo?(khuey) → needinfo?(tchou)
Tapas said the bug is still reproducible even with the patch applied because preallocated processes transform to apps slowly. But the bug was reported that there're multiple preallocated processes from Nuwa do not go away. So I explained what the patch fixes and asked what is the expected result of this bug in comment 16. He then confirmed the bug is fixed with the patch, and will file another bug for "transforming slowly".
Flags: needinfo?(tchou)
Comment on attachment 8477349 [details] [diff] [review]
patch-b2gv2.0

Review of attachment 8477349 [details] [diff] [review]:
-----------------------------------------------------------------

I love removing code.  r=me
Attachment #8477349 - Flags: review?(khuey) → review+
(In reply to Ting-Yu Chou [:ting] from comment #21)
> He then confirmed the bug is fixed with the patch, and
> will file another bug for "transforming slowly".

This "transforming slowly" issue is related to bug 1055299 . I will follow up there.
Posted patch patch-v2.0Splinter Review
Carry r+ from comment 22.
Attachment #8477349 - Attachment is obsolete: true
Attachment #8478765 - Flags: review+
Posted patch patchSplinter Review
Patch for trunk.
Attachment #8478769 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/2e86e0ecbd89
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.1 S3 (29aug)
It seems that this patch has a side-effect.

please check below issue.

https://bugzilla.mozilla.org/show_bug.cgi?id=1079654
You need to log in before you can comment on or make changes to this bug.