Closed Bug 1397675 Opened 7 years ago Closed 7 years ago

Immediately quit the application if no connection can be made during startup

Categories

(Remote Protocol :: Marionette, enhancement, P1)

57 Branch
enhancement

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

Attachments

(1 file)

As seen while investigating bug 1362293 we do not immediately kill the process when a connection attempt times out during startup. Instead `_handle_socket_failure` is getting called because `raise_for_port` uses the `@do_process_check` decorator. This is wrong because this method is just a utility method, and calling code has to use this decorator only.

As result of this we have an additional 120s delay during startup because `_handle_socket_failure` waits for the application to close. But given that no command has been run yet, this will not happen. So we are safe in forcing a shutdown of the process.

Maybe this gives us more ideas what's wrong with bug 1362293.
Attachment #8905639 - Flags: review?(mjzffr)
I have to revise this patch in regards of test suites making only use of Marionette to install extensions, but not to start the binary.
Blocks: 1393366
Blocks: 1261598
Blocks: 1397912
Blocks: 1398693
Priority: -- → P1
Blocks: 1399592
The following failing Mochitest shows that my patch is working fine:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=a86a93afe649&bugfiler&selectedJob=130582432

[task 2017-09-13T08:41:43.831693Z] 08:41:43     INFO - Application command: /builds/worker/workspace/build/application/firefox/firefox -marionette -foreground -profile /tmp/tmp6JqmF3.mozrunner
[task 2017-09-13T08:41:43.871223Z] 08:41:43     INFO - runtests.py | Application pid: 2660
[task 2017-09-13T08:41:43.874276Z] 08:41:43     INFO - TEST-INFO | started process GECKO(2660)
[task 2017-09-13T08:42:43.889715Z] 08:42:43     INFO -  Traceback (most recent call last):
[task 2017-09-13T08:42:43.892906Z] 08:42:43     INFO -    File "/builds/worker/workspace/build/tests/mochitest/runtests.py", line 2635, in doTests
[task 2017-09-13T08:42:43.894930Z] 08:42:43     INFO -      marionette_args=marionette_args,
[task 2017-09-13T08:42:43.896905Z] 08:42:43     INFO -    File "/builds/worker/workspace/build/tests/mochitest/runtests.py", line 2165, in runApp
[task 2017-09-13T08:42:43.898836Z] 08:42:43     INFO -      self.marionette.start_session(timeout=port_timeout)
[task 2017-09-13T08:42:43.901362Z] 08:42:43     INFO -    File "/builds/worker/workspace/build/venv/local/lib/python2.7/site-packages/marionette_driver/decorators.py", line 28, in _
[task 2017-09-13T08:42:43.903278Z] 08:42:43     INFO -      m._handle_socket_failure()
[task 2017-09-13T08:42:43.914077Z] 08:42:43     INFO -    File "/builds/worker/workspace/build/venv/local/lib/python2.7/site-packages/marionette_driver/decorators.py", line 23, in _
[task 2017-09-13T08:42:43.916660Z] 08:42:43     INFO -      return func(*args, **kwargs)
[task 2017-09-13T08:42:43.918745Z] 08:42:43     INFO -    File "/builds/worker/workspace/build/venv/local/lib/python2.7/site-packages/marionette_driver/marionette.py", line 1227, in start_session
[task 2017-09-13T08:42:43.920695Z] 08:42:43     INFO -      self.protocol, _ = self.client.connect()
[task 2017-09-13T08:42:43.922818Z] 08:42:43     INFO -    File "/builds/worker/workspace/build/venv/local/lib/python2.7/site-packages/marionette_driver/transport.py", line 223, in connect
[task 2017-09-13T08:42:43.925004Z] 08:42:43     INFO -      self.sock.connect((self.addr, self.port))
[task 2017-09-13T08:42:43.929669Z] 08:42:43     INFO -    File "/usr/lib/python2.7/socket.py", line 228, in meth
[task 2017-09-13T08:42:43.931578Z] 08:42:43     INFO -      return getattr(self._sock,name)(*args)
[task 2017-09-13T08:42:43.933813Z] 08:42:43     INFO -  error: [Errno 111] Connection refused

Mochitest is inappropriately setting 60s only for the timeout, so we now fail exactly 60s afterward and not 180s! I will bump this timeout once this bug is fixed via bug 1399592.
Attachment #8905639 - Flags: review?(mjzffr)
Comment on attachment 8905639 [details]
Bug 1397675 - Immediately kill the process if no connection can be made after startup.

https://reviewboard.mozilla.org/r/177430/#review184664
Attachment #8905639 - Flags: review?(mjzffr) → review+
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/50288d4db7ec
Immediately kill the process if no connection can be made after startup. r=maja_zf
Blocks: 1389103
https://hg.mozilla.org/mozilla-central/rev/50288d4db7ec
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Depends on: 1400594
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.