Open Bug 2040648 Opened 13 days ago Updated 1 hour ago

[wdspec] Check the Firefox PID on the device instead of the host in `mozilla/tests/webdriver/harness/shutdown.py` on Android

Categories

(Remote Protocol :: Marionette, defect, P3)

defect
Points:
2

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webdriver:m19])

Attachments

(1 file)

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from bug 2039989 comment #3)

Most of the failures here are happening on Android. As I can see in the Android emulator logcat the Marionette:Quit command is successfully received by GeckoView and the application shutdown. But some services got restarted:

https://firefoxci.taskcluster-artifacts.net/bpOqoC0GQRW0pswW3yIb6A/0/public/test_info/logcat-emulator-5554.log

05-18 13:03:59.872  2168  2198 I Gecko   : 1779109439872	Marionette	DEBUG	0 -> [0,2,"Marionette:Quit",{"flags":["eForceQuit"]}]
[..]
05-18 13:04:00.870  2168  2198 I Gecko   : 1779109440870	Marionette	TRACE	Received observer notification xpcom-shutdown
[..]
05-18 13:04:00.907   570   603 I libprocessgroup: Successfully killed process cgroup uid 10192 pid 2296 in 0ms
05-18 13:04:00.907   376   376 I Zygote  : Process 2296 exited due to signal 15 (Terminated)
[..]
05-18 13:04:00.908   570   585 W ActivityManager: Scheduling restart of crashed service org.mozilla.geckoview.test_runner/org.mozilla.gecko.process.GeckoChildProcessServices$gpu in 1000ms for connection
05-18 13:04:00.918  2451  2493 D GeckoThread: State changed to RUNNING
05-18 13:04:00.936   570   585 I ActivityManager: Process org.mozilla.geckoview.test_runner:tab_disable_art_image_12 (pid 2451) has died: fg  BTOP
05-18 13:04:00.937   570   585 W ActivityManager: Scheduling restart of crashed service org.mozilla.geckoview.test_runner/org.mozilla.gecko.process.GeckoChildProcessServices$tab12 in 10971ms for connection
05-18 13:04:00.937   570   603 I libprocessgroup: Successfully killed process cgroup uid 10192 pid 2451 in 0ms
05-18 13:04:00.937   376   376 I Zygote  : Process 2451 exited cleanly (0)
05-18 13:04:00.947   570  1737 I ActivityManager: Process org.mozilla.geckoview.test_runner (pid 2168) has died: fg  TOP 
05-18 13:04:00.949   570  2380 I WindowManager: WIN DEATH: Window{bcf0b3e u0 org.mozilla.geckoview.test_runner/org.mozilla.geckoview.test_runner.App}
05-18 13:04:00.951   376   376 I Zygote  : Process 2168 exited cleanly (0)
[..]
05-18 13:04:01.129   570  1737 I ActivityManager: Force stopping org.mozilla.geckoview.test_runner appid=10192 user=0: from pid 2537
0

The geckodriver logs show:
https://treeherder.mozilla.org/logviewer?job_id=567136456&repo=autoland&task=bpOqoC0GQRW0pswW3yIb6A.0&lineNumber=19596-19635

[task 2026-05-18T13:04:00.929+00:00] 13:04:00     INFO - STDOUT: 1779109440924	mozdevice	TRACE	execute_host_command: >> "shell:kill -0 2168 2>/dev/null; echo $?"
[task 2026-05-18T13:04:00.997+00:00] 13:04:00     INFO - STDOUT: 1779109440996	mozdevice	TRACE	execute_host_command: << "0\n"
[task 2026-05-18T13:04:01.098+00:00] 13:04:01     INFO - STDOUT: 1779109441096	mozdevice	TRACE	execute_host_command: >> "host:transport:emulator-5554"
[task 2026-05-18T13:04:01.099+00:00] 13:04:01     INFO - STDOUT: 1779109441096	mozdevice	TRACE	execute_host_command: << []
[task 2026-05-18T13:04:01.100+00:00] 13:04:01     INFO - STDOUT: 1779109441096	mozdevice	TRACE	execute_host_command: >> "shell:kill -0 2168 2>/dev/null; echo $?"
[task 2026-05-18T13:04:01.109+00:00] 13:04:01     INFO - STDOUT: 1779109441108	mozdevice	TRACE	execute_host_command: << "0\n"
[task 2026-05-18T13:04:01.210+00:00] 13:04:01     INFO - STDOUT: 1779109441208	mozdevice	TRACE	execute_host_command: >> "host:transport:emulator-5554"
[task 2026-05-18T13:04:01.210+00:00] 13:04:01     INFO - STDOUT: 1779109441208	mozdevice	TRACE	execute_host_command: << []
[task 2026-05-18T13:04:01.211+00:00] 13:04:01     INFO - STDOUT: 1779109441208	mozdevice	TRACE	execute_host_command: >> "shell:kill -0 2168 2>/dev/null; echo $?"
[task 2026-05-18T13:04:01.224+00:00] 13:04:01     INFO - STDOUT: 1779109441223	mozdevice	TRACE	execute_host_command: << "0\n"
[task 2026-05-18T13:04:01.325+00:00] 13:04:01     INFO - STDOUT: 1779109441324	mozdevice	TRACE	execute_host_command: >> "host:transport:emulator-5554"
[..]
[task 2026-05-18T13:04:02.036+00:00] 13:04:02     INFO - STDOUT: 1779109442032	mozdevice	TRACE	execute_host_command: << "1\n"
[task 2026-05-18T13:04:02.038+00:00] 13:04:02     INFO - STDOUT: 1779109442032	geckodriver::browser	DEBUG	Android package org.mozilla.geckoview.test_runner has exited
[task 2026-05-18T13:04:02.038+00:00] 13:04:02     INFO - STDOUT: 1779109442032	geckodriver::android	DEBUG	Force stopping the Android package: org.mozilla.geckoview.test_runner
[task 2026-05-18T13:04:02.038+00:00] 13:04:02     INFO - STDOUT: 1779109442032	mozdevice	DEBUG	Force stopping Android package: org.mozilla.geckoview.test_runner
[task 2026-05-18T13:04:02.040+00:00] 13:04:02     INFO - STDOUT: 1779109442032	mozdevice	TRACE	execute_host_command: >> "host:transport:emulator-5554"

The code is around:
https://searchfox.org/firefox-main/rev/0a95d145f781bc57ef4183545cbb88e35d27b66d/testing/geckodriver/src/browser.rs#337-358

And we get:

where False = wait_for_process_exit(2168)

So there is actually an issue with wait_for_process_exit() or in more detail with is_process_alive():

https://searchfox.org/firefox-main/rev/0a95d145f781bc57ef4183545cbb88e35d27b66d/testing/web-platform/mozilla/tests/webdriver/harness/shutdown.py#27

There we call os.kill() which is always run on the host machine but not on the Android device. So we cannot actually determine the process status. We should check how to get the process status from the device.

This test was introduced on bug 1430064.

Depends on: 1430064
Assignee: nobody → hskupin
Status: NEW → ASSIGNED

The severity field is not set for this bug.
:whimboo, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hskupin)
Points: --- → 2
Flags: needinfo?(hskupin)
Priority: -- → P3
Whiteboard: [webdriver:m19]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: