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

v4 to v5 Update Functionality Differences #34

Closed
shellscape opened this issue Jul 14, 2019 · 4 comments
Closed

v4 to v5 Update Functionality Differences #34

shellscape opened this issue Jul 14, 2019 · 4 comments

Comments

@shellscape
Copy link

I may need some guidance as to how to go about nailing down the cause. I'm using getPort in an ava test environment in conjunction with puppeteer and webpack. When using get-port@4.2.0 everything works as expected. After updating to v5, I get multiple test files attempting to use the same port. My only shot-in-the-dark is that it's somehow related to the changes in v5 to the available port code.

Fwiw, my calls to getPort are relatively simple: getPort({ port: 55555 });

@sindresorhus
Copy link
Owner

// @stroncium

@stroncium
Copy link
Contributor

stroncium commented Jul 23, 2019

By design this library doesn't guarantee that it won't give the same result to parallel calls.

There is a very tiny chance of a race condition if another service starts using the same port number as you in between the time you get the port number and you actually start using it.

... works all the same for another part of the same application, which might find the same port(equals starts using then stops using it) before you start to actually use it.

The change in behavior might be related to switch to async which is supposed to slightly change distribution of code execution between ticks.

However, I can't be entirely sure this is the cause in your case and what is actually happening. Need better reproduction steps.

@sindresorhus
Copy link
Owner

Duplicate of #23

@sindresorhus sindresorhus marked this as a duplicate of #23 Dec 18, 2019
@sindresorhus
Copy link
Owner

The in-process race condition you're experiencing was fixed by 73e21d8.

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

No branches or pull requests

3 participants