Closed Bug 938418 Opened 11 years ago Closed 11 years ago

Memory leak when using gaiatest apps.launch() and apps.kill()

Categories

(Remote Protocol :: Marionette, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: rwood, Unassigned)

Details

Attachments

(2 files)

Reported by one of our b2g partners via Mozilla Taiwan. Looks like there is a memory leak when using the gaiatest apps.launch() and apps.kill() / apps.kill_all() methods.

Here are the actual test scenarios and numbers as reported by our partner. They ran 500 iterations of the test cases, with a reset before each scenario.

Scenario 1: Launch phone app via apps.launch(), then kill it via apps.kill(), repeat.

Result: the b2g value of adb shell b2g-info at the beginning:
          
NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER  
b2g 179    0 56.1 59.5 69.6 236.2       0 root

finally it increased to

NAME  PID NICE   USS   PSS   RSS VSIZE OOM_ADJ USER    
b2g  179    0 172.1 175.3 185.7 356.2       0 root 


Scenario 2: Launch phone app via apps.launch() and then press home button to just leave app in background, repeat.

Result:  the b2g value of adb shell b2g-info at the beginning:

NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER  
b2g 179    0 53.3 56.8 66.8 236.0       0 root  

finally it increased to

NAME   PID NICE   USS   PSS   RSS VSIZE OOM_ADJ USER  
b2g   179    0 237.5 240.4 250.9 422.3       0 root


Scenario 3: Launch phone app via touching app icon, kill it via apps.kill_all(), repeat.

Result:  the b2g value of adb shell b2g-info at the beginning:

NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER  
b2g 179    0 55.2 58.6 68.9 234.2       0 root  

increased to (at most)

NAME   PID NICE  USS   PSS   RSS VSIZE OOM_ADJ USER  
b2g   179    0 96.4 100.0 110.1 297.1       0 root 

and then come down to following after the whole experiment 3 finished, that is the automation test stoped.

NAME   PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER  
b2g   179    0 62.7 66.3 76.4 255.3       0 root 


Scenario 4: Launch phone app via touching icon, press home to minimize, repeat.

Result:  the b2g value of adb shell b2g-info at the beginning:

NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER  
b2g 167    0 50.5 53.5 64.2 227.1       0 root  

almost kept at a low level

NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER  
b2g 167    0 48.7 51.8 62.5 225.0       0 root


I wrote a couple of similar gaia-ui endurance tests for scenario 1 and scenario 4 above, and reproduced the leak (hamachi w/latest b2g26/1.2).

My first endurance test (for scenario 1): Launch phone app via apps.launch(), then kill it via apps.kill(), repeat. Ran 150 iterations, checkpoint after every 25 (demonstrates the leak):

test_name: memleak_launch1
completed: 20131113184235
app_under_test: phone
total_iterations: 150
checkpoint_interval: 25
b2g_rss: 80536, 90196, 93192, 102008, 105092, 113652


My 2nd endurance test (for scenario 4): Launch phone app via touching icon, press home to minimize, repeat. Ran 150 iterations, checkpoint after every 25 (no leak):

test_name: memleak_launch2
completed: 20131113185719
app_under_test: phone
total_iterations: 150
checkpoint_interval: 25
b2g_rss: 77076, 71192, 71564, 71980, 71956, 72368

Endurance tests are attached. Is it a leak in marionette.execute_async_script() or is it with one of the other marionette or gaiatest functions used within the apps.launch() and apps.kill() methods?
There's a known leak in mozapps.mgmt.getAll(), which gaiatest had been using until recently (see https://github.com/mozilla-b2g/gaia/commit/c1204e00cff95820b902c1b41dee229402c6a156).  

Was your test run with a version of gaiatest that included the above patch?  If so, we'll have to look and see where the leak is coming from.
(In reply to Jonathan Griffin (:jgriffin) from comment #2)
> There's a known leak in mozapps.mgmt.getAll(), which gaiatest had been using
> until recently (see
> https://github.com/mozilla-b2g/gaia/commit/
> c1204e00cff95820b902c1b41dee229402c6a156).  
> 
> Was your test run with a version of gaiatest that included the above patch? 
> If so, we'll have to look and see where the leak is coming from.

This was bug 924565
Ah sorry I missed that. Nope my gaiatest doesn't have the patch. I will grab the latest and retest. Thanks guys!
Retested with latest gaiatest, much better!

test_name: memleak_launch1
completed: 20131114120931
app_under_test: phone
total_iterations: 150
checkpoint_interval: 25
b2g_rss: 71536, 73660, 70644, 73956, 70508, 74652

Closing this issue.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
FYI: Gaiatest 0.19
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: