Closed Bug 1320987 Opened 3 years ago Closed 3 years ago

test_session_zombification | Unable to restore focus, expect failures and timeouts

Categories

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

defect

Tracking

()

RESOLVED FIXED
Firefox 53
Tracking Status
firefox53 --- fixed

People

(Reporter: gbrown, Assigned: JanH)

References

Details

Attachments

(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.

https://hg.mozilla.org/mozilla-central/annotate/8387a4ada9a5c4cab059d8fafe0f8c933e83c149/testing/mochitest/tests/SimpleTest/TestRunner.js#l312
: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.

https://reviewboard.mozilla.org/r/96652/#review96964

This looks great. Thanks!
Attachment #8815873 - Flags: review?(gbrown) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ffd7e71624b5
Stop leaking tabs during test_session_zombification. r=gbrown
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/ffd7e71624b5
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
You need to log in before you can comment on or make changes to this bug.