[Camera]The camera app has severe performance issues when several applications are running in the background

RESOLVED WORKSFORME

Status

Firefox OS
Gaia::Camera
RESOLVED WORKSFORME
4 years ago
4 years ago

People

(Reporter: cnelson, Assigned: mikeh)

Tracking

({regression})

unspecified
ARM
Gonk (Firefox OS)
regression

Firefox Tracking Flags

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

Details

(Whiteboard: [2.1-Exploratory-3], URL)

(Reporter)

Description

4 years ago
The camera app will suffer from performance issues when there are several applications running in the background.  The performance issue will last for around five to ten seconds, and seems to get better as the user continues usage of the camera app.  
   
Repro Steps:
1) Update a Flame device to BuildID: 20141031001201
2) Open around five to seven applications and let them continue running in the background.
3) Then open the camera app, and pan the device around a little.
4) Notice the camera app will have severe performance for five to ten seconds.
  
Actual:
The camera app has severe performance issues when several applications are running in the background
  
Expected: 
The camera app will not suffer from any performance issues.
  
Environmental Variables:
Device: Flame 2.1
BuildID: 20141031001201
Gaia: f89c7b12c36572262c9ea76058694a139b1a8634
Gecko: 50d48f8a04c7
Gonk: 48835395daa6a49b281db62c50805bd6ca24077e
Version: 34.0 (2.1)
Firmware: V188
User Agent: Mozilla/5.0 (Mobile; rv:34.0) Gecko/34.0 Firefox/34.0

Notes: Unable to grab a logcat with the camera app while plugged into the laptop.
  
Repro frequency: 100%
See attached: video clip https://www.youtube.com/watch?v=i9svsnsIGQA
Flags: needinfo?(dharris)
(Reporter)

Comment 1

4 years ago
This issue does occur on Flame 2.2 Master (319mb)(Kitkat Base)(Full Flash).

The camera app has severe performance issues when several applications are running in the background

Flame 2.2

Device: Flame 2.2 Master (319mb)(Kitkat Base)(Full Flash)
BuildID: 20141031061804
Gaia: a07994714f0552f89801d6097982308d8b0a1ee1
Gecko: 6bd2071b373f
Gonk: 48835395daa6a49b281db62c50805bd6ca24077e
Version: 36.0a1 (2.2) 
Firmware Version: v188
User Agent: Mozilla/5.0 (Mobile; rv:36.0) Gecko/36.0 Firefox/36.0

This issue doesn't occur on Flame 2.0 (319mb)(Kitkat Base)(Full Flash).

The camera app will not suffer from any performance issues.

Flame 2.0

Device: Flame 2.0 (319mb)(Kitkat Base)(Full Flash)
BuildID: 20141031000201
Gaia: 7b8df9941700c1f6d6d51ff464f0c8ae32008cd2
Gecko: 82a6ed695964
Gonk: 48835395daa6a49b281db62c50805bd6ca24077e
Version: 32.0 (2.0) 
Firmware Version: v188
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0
QA Whiteboard: [QAnalyst-Triage?]
5 to 7 apps open in the background will cause performance issues all around usually. This seems like a blocker to me, but NI qa camera owner to weigh in on a blocking decision.
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(dharris) → needinfo?(npark)
[Blocking Requested - why for this release]:
For me, even just 2-3 apps were enough to slow down considerably, especially one is a browser and it displays a load-heavy site.  noming for triage.

Reason: noticeable performance degradation under normal multitasking scenario
blocking-b2g: --- → 2.1?
Flags: needinfo?(npark)

Comment 4

4 years ago
Mike,

Please investigate. 

Thanks
Hema
Assignee: nobody → mhabicher
I suspect that between 2.0 and now, apps and the system have continued to grow, so 319MB isn't enough anymore. Will try to get some numbers.
The key is this comment, "Notice the camera app will have severe performance for five to ten seconds."

This is what happens while the system is swapping and/or killing background processes. If my investigation reflects this, then we'll either need to free up more memory, or increase the 319MB limit.
Unexpected results running v188-1 with:

Gaia-Rev        7c9e7cabbde941b976e0e40a3a1d94e21aa9c5e9
Gecko-Rev       https://hg.mozilla.org/mozilla-central/rev/62990ec7ad78
Build-ID        20141105040206
Version         36.0a1
Device-Name     flame
FW-Release      4.4.2
FW-Incremental  40
FW-Date         Tue Oct 21 15:59:42 CST 2014
Bootloader      L1TC10011880

b2g-info output:

# adb shell b2g-info         
                          |     megabytes     |
           NAME  PID PPID CPU(s) NICE  USS  PSS  RSS SWAP VSIZE OOM_ADJ USER    
            b2g  205    1   86.9    0 17.3 18.3 22.6 40.4 272.0       0 root    
         (Nuwa)  413  205    1.4    0  0.0  0.2  2.6  6.8  71.4     -16 root    
     Homescreen  938  413   23.0   18  5.4  5.8  9.4  9.6  92.2       8 u0_a938 
 Find My Device 1203  413    1.3   18  0.2  0.4  3.4 11.0  81.0      13 u0_a1203
       Messages 1479  205    2.7   18  0.3  0.4  2.7 16.0  95.0      13 u0_a1479
        Gallery 1484  413    1.9   18  0.2  0.4  3.4 13.0  83.1      13 u0_a1484
          Music 1672  413    2.6   18  0.2  0.4  3.4 13.5  83.4      13 u0_a1672
          Video 1714  413    1.9   18  0.2  0.4  3.4 12.7  83.1      12 u0_a1714
         Camera 1785  413   13.8    1  8.7  9.5 13.5  8.6 100.8       2 u0_a1785
    Marketplace 1882  413    1.8   18  0.2  0.5  3.5 13.1  84.4      12 u0_a1882
       Settings 1962  413    4.8   18  0.4  0.6  3.6 17.5  87.4      12 u0_a1962
       Calendar 2029  413    3.2   18  0.2  0.5  3.5 16.5  86.9      11 u0_a2029
         E-Mail 2220  413    3.0   18  0.6  0.8  3.9 16.7  93.2      11 u0_a2220
          Clock 2276  413    2.5   18  1.6  2.0  5.5 11.4  84.7      10 u0_a2276
(Preallocated a 2360  413    0.9   18  4.8  5.3  8.8  5.0  80.5       1 u0_a2360

System memory info:

            Total 215.3 MB
        SwapTotal 192.0 MB
     Used - cache 196.8 MB
  B2G procs (PSS)  45.6 MB
    Non-B2G procs 151.2 MB
     Free + cache  18.5 MB
             Free   2.8 MB
            Cache  15.6 MB
         SwapFree   0.2 MB

Low-memory killer parameters:

  notify_trigger 9216 KB

  oom_adj min_free
        0  4096 KB
       58  5120 KB
      117  6144 KB
      352  7168 KB
      470  8192 KB
      588 10240 KB

So, lots of apps running, and the only time I saw the camera viewfinder stutter was when the "do you want to share your location?" prompt appeared, and then only for an instant.

The one thing I have observed is that with all of these apps open, the Camera takes much longer to start, but it always eventually does, and when it does, the viewfinder is smooth.
Further to comment 7, I see that after some time, the Music and Communications apps are OOM-killed:

<6>[  519.955015] Killing 'Communications' (1388), adj 867,
<6>[  519.955021]    to free 7360kB on behalf of 'kswapd0' (97) because
<6>[  519.955025]    cache 10044kB is below limit 10240kB for oom_score_adj 588
<6>[  519.955029]    Free memory is 2136kB above reserved.
<6>[  519.955033]    Free CMA is 1932kB
<6>[  519.955035]    Total reserve is 2908kB
<6>[  519.955038]    Total free pages is 4068kB
<6>[  519.955041]    Total file cache is 17244kB
<6>[  519.955044]    GFP mask is 0xd0
   ...
<6>[  545.565710] Killing 'Music' (1672), adj 867,
<6>[  545.565715]    to free 3544kB on behalf of 'adbd' (2450) because
<6>[  545.565719]    cache 10232kB is below limit 10240kB for oom_score_adj 588
<6>[  545.565724]    Free memory is 8040kB above reserved.
<6>[  545.565727]    Free CMA is 0kB
<6>[  545.565730]    Total reserve is 2908kB
<6>[  545.565733]    Total free pages is 8040kB
<6>[  545.565736]    Total file cache is 11156kB
<6>[  545.565739]    GFP mask is 0xd0

Camera app performance is not visibly impacted.
No-Jun, can you confirm my result?
Flags: needinfo?(npark)
(In reply to Mike Habicher [:mikeh] from comment #9)
> No-Jun, can you confirm my result?

You're right, I just used the latest 2.1 build shallow flashed into v188-1, and I did not notice the performance degradation on the viewfinder anymore with the background apps running.  Perhaps we can close this issue for now and revisit when it comes back?


Gaia-Rev        9658b93b412bdcc0f953d668e8c8e68318c99fb8
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/76880403db44
Build-ID        20141106001204
Version         34.0
Device-Name     flame
FW-Release      4.4.2
FW-Incremental  40
FW-Date         Tue Oct 21 15:59:42 CST 2014
Bootloader      L1TC10011880
Flags: needinfo?(npark)
Please reopen if this issue appears again.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WORKSFORME
When the problem happens it might be better to get the "top" command result like the following.
> adb shell top -m 20 -t -d 3
Clearing 2.1 blocking nom since WORKSFORME.
blocking-b2g: 2.1? → ---
You need to log in before you can comment on or make changes to this bug.