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

IncrementingPortFinder should check the last port in the range #552

Closed
sleberknight opened this issue Oct 17, 2024 · 0 comments · Fixed by #553
Closed

IncrementingPortFinder should check the last port in the range #552

sleberknight opened this issue Oct 17, 2024 · 0 comments · Fixed by #553
Assignees
Labels
bug Something isn't working
Milestone

Comments

@sleberknight
Copy link
Member

sleberknight commented Oct 17, 2024

Given a range of ports 9000 to 9005, if ports 9000 through 9003 are in use while ports 9004 and 9005 are available, IncrementingPortFinder should find ports 9004 and 9005.

The initial implementation limited the IntStream.iterate to ports below the max port (9005 in the above example), which means it stops checking at 9004 and throws an exception. The iteration should be limited to below or equal to the max port, so that it properly handles the situation when only the last two ports in the allowable range are available.

A classic off by one error!

@sleberknight sleberknight added the bug Something isn't working label Oct 17, 2024
@sleberknight sleberknight added this to the 4.0.0 milestone Oct 17, 2024
@sleberknight sleberknight self-assigned this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant