-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement automatic port reassignment on Windows #19557
Implement automatic port reassignment on Windows #19557
Conversation
ecbbc28
to
c09d0d3
Compare
b0d343f
to
0493a8f
Compare
PTAL @Luap99 I addressed some comments but not sure if you had other concerns. Also @baude so you are aware and in case of concerns Note that there is a discussion @vrothberg and I are having on how the common API should look and the interactions with modules, which will replace an aspect in this PR once right, but if possible I would like to decouple them initially so that the Windows issue is addressed in the meantime. Although of course only if no concerns specific to what this PR introduces. |
LGTM |
0493a8f
to
28f5b83
Compare
PTAL when you get a chance @Luap99 This has been updated to address your last comments (thanks for those!) /cc @containers/podman-maintainers |
@n1hility: GitHub didn't allow me to request PR reviews from the following users: containers/podman-maintainers. Note that only containers members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
28f5b83
to
c4b2507
Compare
While only leveraged by the WSL backend, this commit also adds core infrastructure for all other backends for future enhancement. - Adds a common port cross backend allocation registry to prevent duplicate assignment across multiple machine instances - Introduces logic in Start() that detects OS port conflicts and scans for a viable replacement port - Updates connection definitions and server configuration accordingly - Utilizes a coordinated file lock strategy to prevent racing overwrites of port and connection registries - WSL backend coordinates locking for containers.conf until a future common enhancement exists to replace it [NO NEW TESTS NEEDED] Signed-off-by: Jason T. Greene <[email protected]>
c4b2507
to
63a8926
Compare
PTAL @Luap99 |
lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99, n1hility The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #19554
We have had reports of strange intermittent/infrequent connectivity problems with podman machine which vanish after reboot. While all OS's have the potential for collision in ports in the dynamic range, Windows is significantly more susceptible to them since it uses a number of them internally for various networking services. Further, they have a non-spec reservation mechanism that system services can use which blocks access to arbitrary port ranges in the dynamic space even when not in use. These registrations do not have standard/fixed addresses, and can be arbitrarily relocated (e.g. after a windows update) so can not be predetermined/avoided.
Since there is only 16K ports in the total range, with potentially random assignments > 1K in use (depending on activity) there could be as good of a 1/16 chance each time podman is started to hit a collision. Further, since as other OSes the kernel prefers to allocate dynamic ports in a sequential ring pattern, prolonged system activity (e.g. using on a laptop where reboots are uncommon), the odds of eventually hitting this are high.
This PR addresses the problem by detecting a conflict and dynamically reassigning the ssh port with no action required from the user. While only leveraged by the WSL backend, this commit also adds core infrastructure for all other backends for future enhancement. To make this easier to manage and review, I plan to propose those changes in separate PRs.
Future PRs I plan to submit: