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

Port in use detection on Windows #6721

Closed
feloy opened this issue Apr 6, 2023 · 2 comments · Fixed by #7041
Closed

Port in use detection on Windows #6721

feloy opened this issue Apr 6, 2023 · 2 comments · Fixed by #7041
Assignees
Labels
area/dev Issues or PRs related to `odo dev` area/Windows Issues or PRs specific to Windows kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@feloy
Copy link
Contributor

feloy commented Apr 6, 2023

/kind bug

What versions of software are you using?

Operating System:

Windows 10

Output of odo version:

How did you run odo exactly?

Running 2 sessions of odo dev, one on podman and one on cluster:

odo dev --platform podman
[...]
- Forwarding from 127.0.0.1:20001 -> 8080
odo dev
[...]
Unable to listen on port 20001: [...] bind: Only one usage of each socket address is normally permitted [...]

Actual behavior

The second session tries to reuse the port 20001, wh it is already in use.

Expected behavior

The second session should detect the port 20001 is already in use, and use the next one (20002)

Any logs, error output, etc?

@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Apr 6, 2023
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 6, 2023
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 6, 2023
@rm3l rm3l added area/Windows Issues or PRs specific to Windows area/dev Issues or PRs related to `odo dev` and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. labels Jul 6, 2023
@redhat-developer redhat-developer deleted a comment from github-actions bot Aug 23, 2023
@rm3l
Copy link
Member

rm3l commented Aug 23, 2023

/assign @rm3l

Taking a look at this issue, as I currently have a Windows VM at hand..

@rm3l
Copy link
Member

rm3l commented Aug 25, 2023

After trying to reproduce this issue on Windows, I noticed that detection of ports in use for port-forwarding is actually already fixed by #6479 (introduction of custom addresses for port forwarding).
However, we still have an issue when starting the recent API Server on Windows, where the default port (20000) would still be considered available on Windows:

Logs

The first session would start successfully:

PS W:\tmp\6721-port-in-use-detection-on-windows> odo dev --platform podman
  __
 /  \__     Developing using the "port-in-use-detection-on-windows" Devfile
 \__/  \    Platform: podman
 /  \__/    odo version: v3.14.0
 \__/

- Running on podman in Dev mode
 V  Web console accessible at http://localhost:20000/
 V  API Server started at http://localhost:20000/api/v1
 V  API documentation accessible at http://localhost:20000/swagger-ui/
 V  Deploying pod [4s]
 V  Syncing files into the container [810ms]
 V  Building your application in container (command: install) [4s]
 -  Executing the application (command: run)  ...
 V  Waiting for the application to be ready [1s]
 -  Forwarding from 127.0.0.1:20001 -> 3000

- Dev mode
 Status:
 Watching for changes in the current directory W:\tmp\6721-port-in-use-detection-on-windows

Web console accessible at http://localhost:20000/

Keyboard Commands:
[Ctrl+c] - Exit and delete resources from podman
     [p] - Manually apply local changes to the application on podman

But from now on, it would be impossible to start any other Dev session:

PS W:\tmp\6721-port-in-use-detection-on-windows> odo dev
  __
 /  \__     Developing using the "port-in-use-detection-on-windows" Devfile
 \__/  \    Namespace: default
 /  \__/    odo version: v3.14.0
 \__/

 !  You are using "default" namespace, odo may not work as expected in the default namespace.
 !  You may set a new namespace by running `odo create namespace <name>`, or set an existing one by running `odo set namespace <name>`

- Running on the cluster in Dev mode
Cleaning resources, please wait
 X  unable to start API Server listener on port 20000: listen tcp :20000: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

#7041 fixes the port detection issue n Windows when trying to start the API Server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dev Issues or PRs related to `odo dev` area/Windows Issues or PRs specific to Windows kind/bug Categorizes issue or PR as related to a bug.
Projects
Archived in project
2 participants