Closed Bug 1358988 Opened 2 years ago Closed 2 years ago

Write port to marionette.port after binding

Categories

(Testing :: Marionette, enhancement)

Version 3
enhancement
Not set

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: ato, Assigned: ato)

Details

Attachments

(1 file)

If the Marionette is asked to bind to port 0, the system will atomically bind to a free port in the ephemeral range.  To communicate this port back to the client, it would be useful to write it to the profile.

After the TCP listener binds to the port, we should write the assigned port to marionette.port.
Assignee: nobody → ato
Status: NEW → ASSIGNED
Comment on attachment 8860853 [details]
Bug 1358988 - Write Marionette port to preference when binding;

https://reviewboard.mozilla.org/r/132844/#review135746

::: commit-message-73752:6
(Diff revision 1)
> +Bug 1358988 - Write Marionette port to preference when binding; r?whimboo
> +
> +Write the allocated port to the marionette.port preference when binding
> +the TCP socket server to the requested port.
> +
> +If the socket is bouund to port 0, this instructs the system to atomically

s/bouund/bound

::: commit-message-73752:10
(Diff revision 1)
> +
> +If the socket is bouund to port 0, this instructs the system to atomically
> +allocate a free port in the ephemeral range.  Writing the resolved port
> +to a preference will make it possible to communicate this port number
> +to the client, removing any chance of a race condition occurring by the
> +client looking for a free port (binding and releasing) for the server.

This is great! Then we only would need a capability via mozprofile to read back current preferences. 

Sadly this would still not work for connecting Marionette to an already running instance.
Attachment #8860853 - Flags: review?(hskupin) → review+
Comment on attachment 8860853 [details]
Bug 1358988 - Write Marionette port to preference when binding;

https://reviewboard.mozilla.org/r/132844/#review135746

> s/bouund/bound

Fixed.

> This is great! Then we only would need a capability via mozprofile to read back current preferences. 
> 
> Sadly this would still not work for connecting Marionette to an already running instance.

You are right, but it will solve the first headache you mentioned.  I think that this is a good compromise for the time being.

With regards to mozprofile and using it in the Marionette Python client, we should probably wait until this change has propagated through all the trees.  The same unfortunately applies to geckodriver.
Comment on attachment 8860853 [details]
Bug 1358988 - Write Marionette port to preference when binding;

https://reviewboard.mozilla.org/r/132844/#review135746

> Fixed.

BTW, you could have raised an issue on this (-:
Pushed by atolfsen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7b3dff397282
Write Marionette port to preference when binding; r=whimboo
https://hg.mozilla.org/mozilla-central/rev/7b3dff397282
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.