Closed Bug 1320987 Opened 5 years ago Closed 5 years ago

test_session_zombification | Unable to restore focus, expect failures and timeouts


(Firefox for Android Graveyard :: Testing, defect, P2)



(firefox53 fixed)

Firefox 53
Tracking Status
firefox53 --- fixed


(Reporter: gbrown, Assigned: JanH)




(1 file)

On every run of Android mochitest-chrome, an "Unable to restore focus" error is logged by the test harness following test_session_zombification (and continues for all subsequent tests).

[task 2016-11-29T11:55:18.360205Z] 11:55:18     INFO -  138 INFO TEST-START | mobile/android/tests/browser/chrome/test_session_zombification.html
[task 2016-11-29T11:56:58.216413Z] 11:56:58     INFO -  139 INFO TEST-OK | mobile/android/tests/browser/chrome/test_session_zombification.html | took 91708ms
[task 2016-11-29T11:56:58.216509Z] 11:56:58     INFO -  140 INFO Error: Unable to restore focus, expect failures and timeouts.

This does not cause a test failure and mochitest-chrome is generally green, but there are low-frequency intermittent crash reports for mochitest-chrome, during and after test_session_zombification - bug 1319196. The crashes are actually aborts, caused by the test harness when it cannot determine the foreground application ('adb shell dumpsys...' times out).

I don't know why dumpsys times out, but it seems well correlated with "unable to restore focus", so I want to see that investigated and eliminated if possible.
:JanH -- Can you look into this?
Flags: needinfo?(jh+bugzilla)
Priority: -- → P2
After a wild goose chase because I had no real idea how to interpret that focus error, I've finally hit the solution: 

I was relying on the cleanup functions to close the test tabs immediately after each subtest. In practice however, those cleanup functions only run at the very end of the test, after *all* subtests have run. This means of course that during the second subtest, I was overwriting the tab references to the tabs opened during the first subtest and consequently leaking and never closing them.

Because of this, the test harness tab then ended up in the background and couldn't be focused properly.
Assignee: nobody → jh+bugzilla
Flags: needinfo?(jh+bugzilla)
Comment on attachment 8815873 [details]
Bug 1320987 - Stop leaking tabs during test_session_zombification.

This looks great. Thanks!
Attachment #8815873 - Flags: review?(gbrown) → review+
Pushed by
Stop leaking tabs during test_session_zombification. r=gbrown
Keywords: checkin-needed
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.