Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition in port selection #8

Open
sminnee opened this issue Nov 11, 2016 · 5 comments
Open

Race condition in port selection #8

sminnee opened this issue Nov 11, 2016 · 5 comments

Comments

@sminnee
Copy link
Member

sminnee commented Nov 11, 2016

This bash script will break the find-a-free-port code

for x in 1 2 3 4 5; do  bin/serve --bootstrap-file framework/tests/behat/serve-bootstrap.php --open & done

The best fix is probably to retry on a new port if the php -S process fails to start.

@tractorcow
Copy link

Shouldn't serve take a parameter to an assigned port? Picking a random port will make behat configuration difficult, for instance, where a specific port is necessary.

@sminnee
Copy link
Member Author

sminnee commented Nov 29, 2016

No - in the planned refactoring, Behat will be passed a Server object that has getHost(), getPort(), and getURL() methods. There won't be any need to load host details into behat.yml.

The code is given a preferred port number, and if that is available, it uses that. However, if that port is unavailable it autoincrements until it finds a free port.

@tractorcow
Copy link

Oh I see, sorry I was missing the context.

I would like to see less reliance on behat.yml to hard-code these settings, and more live-configuration such as this.

@dhensby
Copy link
Contributor

dhensby commented Jun 29, 2018

still a problem?

@sminnee
Copy link
Member Author

sminnee commented Jun 30, 2018

A brief review of the code suggests that it hasn't been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants