Closed Bug 1678708 Opened 4 years ago Closed 4 years ago

UnknownException: NotSupportedError: ChromeUtils.registerWindowActor: 'MarionetteCommands' actor is already registered

Categories

(Remote Protocol :: Marionette, defect, P3)

Default
defect

Tracking

(Fission Milestone:M7, firefox85 fixed)

RESOLVED FIXED
85 Branch
Fission Milestone M7
Tracking Status
firefox85 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Whiteboard: [marionette-fission-mvp])

Attachments

(1 file)

Aborting a current test job for Marionette with Ctrl+C the following error gets thrown:

UnknownException: NotSupportedError: ChromeUtils.registerWindowActor: 'MarionetteCommands' actor is already registered.

  File "/Users/henrik/code/gecko/testing/marionette/mach_commands.py", line 112, in marionette_test
    return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)
  File "/Users/henrik/code/gecko/testing/marionette/mach_commands.py", line 59, in run_marionette
    failed = MarionetteHarness(MarionetteTestRunner, args=vars(args)).run()
  File "/Users/henrik/code/gecko/testing/marionette/harness/marionette_harness/runtests.py", line 77, in run
    runner.run_tests(tests)
  File "/Users/henrik/code/gecko/testing/marionette/harness/marionette_harness/runner/base.py", line 1089, in run_tests
    self.cleanup()
  File "/Users/henrik/code/gecko/testing/marionette/harness/marionette_harness/runner/base.py", line 1300, in cleanup
    self.marionette.start_session()
  File "/Users/henrik/code/gecko/testing/marionette/client/marionette_driver/decorators.py", line 27, in _
    return func(*args, **kwargs)
  File "/Users/henrik/code/gecko/testing/marionette/client/marionette_driver/marionette.py", line 1186, in start_session
    reraise(exc_type, exc_type(value.message), tb)
  File "/Users/henrik/code/gecko/testing/marionette/client/marionette_driver/marionette.py", line 1179, in start_session
    resp = self._send_message("WebDriver:NewSession", capabilities)
  File "/Users/henrik/code/gecko/testing/marionette/client/marionette_driver/decorators.py", line 27, in _
    return func(*args, **kwargs)
  File "/Users/henrik/code/gecko/testing/marionette/client/marionette_driver/marionette.py", line 625, in _send_message
    self._handle_error(err)
  File "/Users/henrik/code/gecko/testing/marionette/client/marionette_driver/marionette.py", line 647, in _handle_error
    raise errors.lookup(error)(message, stacktrace=stacktrace)

The problem here seems that we are trying to create a new session via WebDriver:NewSession even a session is actually active. Actually we don't allow this code to run because we check this.sessionID and return early in that command:

https://searchfox.org/mozilla-central/rev/2efcda6dc74c63863fd8f04a6d9d7ac6b09c7eca/testing/marionette/driver.js#773-775

Not sure what that is not happening here.

Ok, so when the connection drops, and Marionette re-connects a new GeckoDriver instance is getting created, and as such the sessionID is set to null inside the constructor.

The easiest solution to fix this problem would be similar to what we do with MarionetteEventsActor, and just ignore the error:

https://searchfox.org/mozilla-central/rev/2efcda6dc74c63863fd8f04a6d9d7ac6b09c7eca/testing/marionette/actors/MarionetteEventsParent.jsm#77-82

But I'm a bit worried that a GeckoDriver instance is left-behind. Or maybe it's getting destroyed, but the JS code misses to call into WebDriver:DeleteSession firs.t

So we have a onclose handler set:
https://searchfox.org/mozilla-central/rev/2efcda6dc74c63863fd8f04a6d9d7ac6b09c7eca/testing/marionette/server.js#195-200

But as it looks like the Marionette client never closes the actual connection when hitting Ctrl+C, and as such no clean-up takes place.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED

Tracking marionette-fission-mvp bugs for Fission Beta milestone (M7).

Fission Milestone: --- → M7
Blocks: 1679414
No longer blocks: 1679414
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d22dc65be538 [marionette] Hardening registration and unregistration of MarionetteCommands actor. r=marionette-reviewers,maja_zf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: