Skip to content

Retry port finding #1572

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

Closed
1 of 2 tasks
u9520107 opened this issue Nov 16, 2018 · 1 comment · Fixed by #1692
Closed
1 of 2 tasks

Retry port finding #1572

u9520107 opened this issue Nov 16, 2018 · 1 comment · Fixed by #1692

Comments

@u9520107
Copy link

  • Operating System: Windows 10
  • Node Version: 10.12.0
  • NPM Version: 6.4.1 (yarn 1.12.1)
  • webpack Version: 4.21.0
  • webpack-dev-server Version: 3.1.9
  • This is a bug
  • This is a modification request

Code

  // webpack.config.js
  // Not really config related issue

Expected Behavior

When I start 2 instances of dev servers without specifying port, both instances can figure out available ports and start up correctly.

Actual Behavior

During the findPort phase, both instances will find the same port that is not being used, then both instances will try to use the same port to start the server, resulting in one of them inevitably errors out.

For Bugs; How can we reproduce the behavior?

For Features; What is the motivation and/or use-case for the feature?

I am not sure how often people try to fire up multiple instances like this, so I'd consider this a feature request. And I think for a workbench like monorepo setup to quickly prototype ideas, this feature can be helpful.
It is possible add a retry port finding procedure when starting servers, so that when this kind of race condition occurs, the instance that lost the race would find the next available port and try again?
I know is is potentially bad if there is no limit to the retry mechanism, perhaps a new parameter for specifying the allowed port ranges would be helpful?

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

Successfully merging a pull request may close this issue.

2 participants