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

RESOLVED INVALID

Status

Testing
Marionette
RESOLVED INVALID
4 years ago
4 years ago

People

(Reporter: rwood, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

4 years ago
Created attachment 831904 [details]
test_endurance_memleak_launch1.py

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?
(Reporter)

Comment 1

4 years ago
Created attachment 831905 [details]
test_endurance_memleak_launch2.py
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
(Reporter)

Comment 4

4 years ago
Ah sorry I missed that. Nope my gaiatest doesn't have the patch. I will grab the latest and retest. Thanks guys!
(Reporter)

Comment 5

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → INVALID
(Reporter)

Comment 6

4 years ago
FYI: Gaiatest 0.19
You need to log in before you can comment on or make changes to this bug.