Closed Bug 1000064 Opened 7 years ago Closed 7 years ago

[Tarako][Music] Background Music app exits when doing something that can consume a lot memory

Categories

(Firefox OS Graveyard :: Performance, defect, P2)

Other
Gonk (Firefox OS)
defect

Tracking

(b2g-v1.3T affected)

RESOLVED DUPLICATE of bug 1002897
2.0 S1 (9may)
Tracking Status
b2g-v1.3T --- affected

People

(Reporter: bli, Unassigned)

References

Details

(Keywords: memory-footprint, perf, Whiteboard: [c=memory p= s=2014.05.09.t u=tarako] [MemShrink:P2] [sprd287908] LMK, )

Attachments

(2 files)

233.01 KB, text/x-log
Details
712.24 KB, text/x-log
Details
Attached file logcat
Environment:
---------------------------------------------------
Gaia      9aa9b04049f0291b124c50e0f9c3ce0e1f547725
Gecko     https://hg.mozilla.org/releases/mozilla-b2g28_v1_3t/rev/2e40920b1d13
BuildID   20140422164001
Version   28.1
ro.build.version.incremental=eng.cltbld.20140422.202702
ro.build.date=Tue Apr 22 20:27:12 EDT 2014


Steps to reproduce:
---------------------------------------------------
1. Launch Music
2. Choose a song to play
3. Press the home key to put music in background
4. Do something which will consume a lot of memory, such as
   Launch Settings->Display->Change wallpaper
   or  Launch SMS-> Create a new message -> Attach a picture to the message.


Actual result:
---------------------------------------------------
Music exits and could not resume. 
Launch Music again, the album page shows up.


Expected result:
---------------------------------------------------
Music should not exit.


Additional info:
---------------------------------------------------
What seems really strange to me is that I cannot find info about low memory kill in the logcat.
Unable to find any something about memory in logcat.

Maybe it isn't related to memory pressure.
Summary: [Tarako][Music] Background Music app exits when memory pressure is high → [Tarako][Music] Background Music app exits when doing something that can consume a lot memory
It's hard to say.  If you search for kill there's at least 3 listed.  I think we need to know the pid?
Keywords: footprint, perf
Whiteboard: LMK, [c=memory p= s= u=] [MemShrink]
Attached file logcat-v2
I can reproduce this issue on build 20140423014003 with following steps:

1. Launch Music
2. Tap on the musical note icon, which is on the bottom right, to switch to the 'Songs' page
3. Choose a song to play
4. Press the home key to put music in background
5. Launch Settings and wait for a while (10~15 seconds, sometimes maybe longer)

b2g-info before music launched:
-----------------------------------------------------------------------
                         |     megabytes     |
           NAME PID PPID CPU(s) NICE  USS  PSS  RSS VSIZE OOM_ADJ USER   
            b2g  84    1   73.2    0 30.3 33.7 39.8 148.4       0 root   
         (Nuwa) 329   84    2.0    0  0.3  1.5  4.3  49.4       0 root   
     Homescreen 768  329    4.8    1 10.7 14.8 21.8  64.5       2 app_768
(Preallocated a 926  329    1.1   18  6.1  8.9 14.6  56.4       1 root   

System memory info:

            Total 98.0 MB
     Used - cache 75.7 MB
  B2G procs (PSS) 59.0 MB
    Non-B2G procs 16.7 MB
     Free + cache 22.4 MB
             Free  2.2 MB
            Cache 20.1 MB


b2g-info after music launched
-----------------------------------------------------------------------------
                          |     megabytes     |
           NAME  PID PPID CPU(s) NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
            b2g   84    1   85.2    0 18.5 20.7 26.6 154.5       0 root    
         (Nuwa)  329   84    2.1    0  0.2  1.2  4.1  49.4       0 root    
          Music  926  329   24.6    7  7.6 10.2 16.9  78.3       6 app_926 
     Homescreen 1033  329    5.6    1  8.6 11.2 18.0  66.5       2 app_1033
(Preallocated a 1087  329    1.8   18  6.2  8.1 13.6  58.4       1 root    

System memory info:

            Total 98.0 MB
     Used - cache 80.1 MB
  B2G procs (PSS) 51.4 MB
    Non-B2G procs 28.7 MB
     Free + cache 17.9 MB
             Free  1.9 MB
            Cache 16.0 MB


b2g-info while the music being played:
-------------------------------------------------------------------------
                          |     megabytes     |
           NAME  PID PPID CPU(s) NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
            b2g   84    1   85.6    0 17.4 19.5 24.9 147.5       0 root    
         (Nuwa)  329   84    2.1    0  0.2  1.2  4.1  49.4       0 root    
          Music  926  329   26.9    7  6.8  9.2 15.6  78.3       6 app_926 
     Homescreen 1033  329    5.7    1  8.3 10.7 17.0  65.5       2 app_1033
(Preallocated a 1087  329    1.9   18  5.9  7.7 12.8  57.4       1 root    

System memory info:

            Total 98.0 MB
     Used - cache 79.0 MB
  B2G procs (PSS) 48.2 MB
    Non-B2G procs 30.8 MB
     Free + cache 19.0 MB
             Free  2.4 MB
            Cache 16.6 MB


b2g-info after settings launched:
------------------------------------------------------------------------------
                          |     megabytes     |
           NAME  PID PPID CPU(s) NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
            b2g   84    1   92.2    0 24.2 27.2 32.9 151.8       0 root    
         (Nuwa)  329   84    2.2    0  0.2  1.2  4.0  49.4       0 root    
          Music  926  329   29.7    7  2.3  4.7 10.2  77.3       6 app_926 
       Settings 1087  329    4.4    1 12.2 15.2 21.2  66.8       2 app_1087
(Preallocated a 1172  329    0.1   18  0.4  0.7  1.9  52.4       8 root    
(Preallocated a 1184  329    0.0   18  0.4  0.6  1.6  52.4       1 root    

System memory info:

            Total 98.0 MB
     Used - cache 77.9 MB
  B2G procs (PSS) 49.5 MB
    Non-B2G procs 28.3 MB
     Free + cache 20.2 MB
             Free  1.3 MB
            Cache 18.9 MB


b2g-info after music exit:
--------------------------------------------------------------------------------
                          |     megabytes     |
           NAME  PID PPID CPU(s) NICE  USS  PSS  RSS VSIZE OOM_ADJ USER    
            b2g   84    1   93.9    0 23.1 26.0 31.1 152.8       0 root    
         (Nuwa)  329   84    2.2    0  0.1  1.1  3.6  49.4       0 root    
       Settings 1087  329    9.3    1 15.5 18.8 24.4  74.9       2 app_1087
(Preallocated a 1184  329    1.6   18  5.8  8.2 13.0  58.4       1 root    

System memory info:

            Total 98.0 MB
     Used - cache 76.5 MB
  B2G procs (PSS) 54.1 MB
    Non-B2G procs 22.4 MB
     Free + cache 21.5 MB
             Free  2.6 MB
            Cache 19.0 MB


Build Info
---------------------------------------------------------
Gaia      9aa9b04049f0291b124c50e0f9c3ce0e1f547725
Gecko     https://hg.mozilla.org/releases/mozilla-b2g28_v1_3t/rev/5dc3e5ec4178
BuildID   20140423014003
Version   28.1
ro.build.version.incremental=eng.cltbld.20140423.074854
ro.build.date=Wed Apr 23 07:49:00 EDT 2014
doesn't look like killed by LMK, would you mind taking a look on it? thanks.
Flags: needinfo?(dkuo)
blocking-b2g: --- → 1.3T?
Flags: needinfo?(dkuo)
Flags: needinfo?(dkuo)
(In reply to Steven Yang [:styang] from comment #4)
> doesn't look like killed by LMK, would you mind taking a look on it? thanks.

By looking on the log in comment 3 and tested on my tarako, I think music is killed by LMK because, once I launched the settings app, or even just pressed home to put the playing music app in background, then music app closed silently which should be killed by LMK.

If music app encountered this situation so frequently, then we probably need to think bug 997123 for a backup plan.
Flags: needinfo?(dkuo)
Let's move this to performance and try to see first 20 sec of Settings launch. There might be something heavy loaded when Settings starts, either by idle timer or xhr etc.
Component: Gaia::Music → Performance
In music cases, we found there is memory fragment problem and it caused LMK was triggered by low swapfree. Sprd has fixed this issue by below two commits:

commit e6cefba51b1030f44b346544668ca27a0ca6027b
Author: Yiwen Liu <yiwen.liu@spreadtrum.com>
Date:   Wed Apr 23 20:25:19 2014 +0800

    Bug #305050 fix memory frag bug
    
    [bug number  ]
    [root cause  ]
    [changes     ]
    [side effects]
    [self test   ] compile ok
    [reviewers   ]
    
    Change-Id: I403c8f45283d86cfed805218046f671961a66c50

commit 23b354a18bbb3e8c8dd49f9068b27ed46208949b
Author: Yiwen Liu <yiwen.liu@spreadtrum.com>
Date:   Thu Apr 24 15:37:59 2014 +0800

    Bug #305050 high order reserve threshold change from 40 to 80
    
    [bug number  ]
    [root cause  ]
    [changes     ]
    [side effects]
    [self test   ] need test
    [reviewers   ]
    
    Change-Id: If0822a40ed78af9650caf8d8bd88cccbf03408ed

W/ these patches, I cannot reproduce the case of https://bugzilla.mozilla.org/show_bug.cgi?id=1000064#c3.
For Launch Settings->Display->Change wallpaper w/ background music, cannot reproduce it.
For Launch SMS-> Create a new message -> Attach a picture to the message w/ background music, Music will be killed by attached 3~4 pictures.
It has been observed that there is about 6.8MB memory consumption when loading freetype fonts[1]. In settings app the font is loaded for the stk menu, which might introduce the issue here. Please see also bug 992150 for details. 

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=997007#c0
I can't reproduce comment 3. If it really an issue, I will suspect Settings requires a bunch of API while loading, and objects returned by API didn't been released.

Per comment 7, I think we need QA to verify again if this case of comment 3 is valid.
Keywords: qawanted
As to comment 0 problem, I think it's a general issue: when foreground app reaches a memory peak thus causing memory pressure, we need a decision either kill foreground or kill background music. A foreground app/website might be possible to consumes too much memory. We need a product clarification on this case.
Flags: needinfo?(mkhoo)
If QA cannot reproduce this on newer builds, we should simply closed this bug as FIXED or WORKSFORME.
Bingqing, could you help to reproduce it on current build? thanks!
Flags: needinfo?(bli)
Case 1: 
----------------------------------------------------
1. Play music in background
2. Launch Settings->Display
3. Change wallpaper->Select 'Gallery'
   --> Music exits after select a picture whose resolution is 1280x800.


Case 2
-----------------------------------------------------
1. Play music in background
2. Launch Settings->Display
3. Change wallpaper->Select 'Wallpaper'
4. Repeat step 3 for 2~3 times
   --> Music exits


Case 3
----------------------------------------------------
1. Play music in background
2. Launch SMS-> Create a new message
3. Attach a picture to the message
4. Repeat step 3 for 2~3 times
   --> Music exits


Build Info
-----------------------------------------------------
Gaia      4dd06db93607f55694953fe60751eddb4bbb5afc
Gecko     https://hg.mozilla.org/releases/mozilla-b2g28_v1_3t/rev/db579b1c75ed
BuildID   20140427014001
Version   28.1
ro.build.version.incremental=eng.cltbld.20140427.054628
ro.build.date=Sun Apr 27 05:46:39 EDT 2014
Flags: needinfo?(bli)
Whiteboard: LMK, [c=memory p= s= u=] [MemShrink] → LMK, [c=memory p= s= u=] [MemShrink] [partner-blocker]
(In reply to Bingqing Li from comment #13)
> Case 1: 
> ----------------------------------------------------
> 1. Play music in background
> 2. Launch Settings->Display
> 3. Change wallpaper->Select 'Gallery'
>    --> Music exits after select a picture whose resolution is 1280x800.

This is reproducible with an image over 1280 x 800, but it needs to be done repeatedly as Case 2 stated. It happened to me on the 2nd try, and repro rate seems pretty stable subsequently.


> Case 2
> -----------------------------------------------------
> 1. Play music in background
> 2. Launch Settings->Display
> 3. Change wallpaper->Select 'Wallpaper'
> 4. Repeat step 3 for 2~3 times
>    --> Music exits

Same as above.


> Case 3
> ----------------------------------------------------
> 1. Play music in background
> 2. Launch SMS-> Create a new message
> 3. Attach a picture to the message
> 4. Repeat step 3 for 2~3 times
>    --> Music exits

This only happened to me the first time out of all 8 attempts, and it happened during loading Gallery app for the first time after a newly-flashed device. All subsequent attempts didn't stop music from playing. 

However it could take up to ~10 minutes for an MMS to be sent out with music playing in the background, and if lockscreen was engaged during waiting, the SMS and Dialer apps disappear in Homescreen upon unlocking.


Tested on:
Device: Tarako 1.3T MOZ
BuildID: 20140428014001
Gaia: 8895b180ed636069473703d0e7b73086989601ce
Gecko: 7caf4b5abfce
Version: 28.1
Firmware Version: sp6821a_gonk4.0_user.pac
Keywords: qawanted
Hi all,
as discussed with Tim, dkuo, Steven and Joe. I have decided and submitted Bug 1002897 for keeping media tag in system app.
Flags: needinfo?(mkhoo)
Verify with today's daily build
Gaia      8895b180ed636069473703d0e7b73086989601ce
Gecko     https://hg.mozilla.org/releases/mozilla-b2g28_v1_3t/rev/7caf4b5abfce
BuildID   20140428014001

For comment 13, I can reproduce Case 2 and Case 3 100%, Case 1 can be reproduced only on first time using Gallery
Whiteboard: LMK, [c=memory p= s= u=] [MemShrink] [partner-blocker] → LMK, [c=memory p= s= u=] [MemShrink:P2] [partner-blocker]
Re-test on build 20140429164003.

Per comment 13(In reply to Bingqing Li from comment #13)
> Case 1: 
> ----------------------------------------------------
> 1. Play music in background
> 2. Launch Settings->Display
> 3. Change wallpaper->Select 'Gallery'
>    --> Music exits after select a picture whose resolution is 1280x800.
> 
Can reproduce.

> Case 2
> -----------------------------------------------------
> 1. Play music in background
> 2. Launch Settings->Display
> 3. Change wallpaper->Select 'Wallpaper'
> 4. Repeat step 3 for 2~3 times
>    --> Music exits
> 
Can reproduce.


> Case 3
> ----------------------------------------------------
> 1. Play music in background
> 2. Launch SMS-> Create a new message
> 3. Attach a picture to the message
> 4. Repeat step 3 for 2~3 times
>    --> Music exits
>
Can reproduce.


Build Info:
----------------------------------------------------
Gaia      f48eb064b786652528af1c8fa6a4784695732bc9
Gecko     https://hg.mozilla.org/releases/mozilla-b2g28_v1_3t/rev/bc5f0e461c9e
BuildID   20140429164003
Version   28.1
ro.build.version.incremental=eng.cltbld.20140429.202101
ro.build.date=Tue Apr 29 20:21:11 EDT 2014
Whiteboard: LMK, [c=memory p= s= u=] [MemShrink:P2] [partner-blocker] → LMK, [c=memory p= s= u=] [MemShrink:P2] [partner-blocker][sprd287908]
We are going to look if https://bugzilla.mozilla.org/show_bug.cgi?id=1002897  is possible to get worked on in which case the issue in this report will be resolved.
Priority: -- → P2
let's track this on bug 1002897
Status: NEW → RESOLVED
blocking-b2g: 1.3T? → ---
Closed: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1002897
Whiteboard: LMK, [c=memory p= s= u=] [MemShrink:P2] [partner-blocker][sprd287908] → [c=memory p= s=2014.05.09.t u=] [MemShrink:P2] [partner-blocker][sprd287908] LMK,
Whiteboard: [c=memory p= s=2014.05.09.t u=] [MemShrink:P2] [partner-blocker][sprd287908] LMK, → [c=memory p= s=2014.05.09.t u=tarako] [MemShrink:P2] [partner-blocker][sprd287908] LMK,
Whiteboard: [c=memory p= s=2014.05.09.t u=tarako] [MemShrink:P2] [partner-blocker][sprd287908] LMK, → [c=memory p= s=2014.05.09.t u=tarako] [MemShrink:P2] [sprd287908] LMK,
Target Milestone: --- → 2.0 S1 (9may)
You need to log in before you can comment on or make changes to this bug.