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

[MacOS] Cannot run 2 dev sessions simultaneously on cluster #6744

Closed
valaparthvi opened this issue Apr 18, 2023 · 4 comments
Closed

[MacOS] Cannot run 2 dev sessions simultaneously on cluster #6744

valaparthvi opened this issue Apr 18, 2023 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/*` and requires one.

Comments

@valaparthvi
Copy link
Contributor

valaparthvi commented Apr 18, 2023

/kind bug

What versions of software are you using?

Operating System:
MacOS

$ uname -a
Darwin pvala-mac 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

Output of odo version:

odo v3.9.0 (7f25f0cf6)

Server: https://kubernetes.docker.internal:6443
Kubernetes: v1.25.4

How did you run odo exactly?

mkdir /tmp/frontend
odo init --devfile nodejs --name my-node-app-cluster --starter nodejs-starter
odo dev

mkdir /tmp/backend; cd /tmp/backend
odo init --devfile go --name my-go-app-cluster --starter go-starter
odo dev

Actual behavior

  1. odo dev from backend fails to fetch correct local port.
$ odo dev 
  __
 /  \__     Developing using the "my-go-app-cluster" Devfile
 \__/  \    Namespace: default
 /  \__/    odo version: v3.9.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
 •  Waiting for Kubernetes resources  ...
 ⚠  Pod is Pending
 ✓  Pod is Running
 ✓  Syncing files into the container [122ms]
 ✓  Building your application in container (command: build) [355ms]
 •  Executing the application (command: run)  ...
 ✓  Waiting for the application to be ready [1s]
Unable to listen on port 20001: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:20001: bind: address already in use unable to create listener: Error listen tcp6 [::1]:20001: bind: address already in use]
Failed to setup port-forwarding: unable to listen on any of the requested ports: [{20001 8080}]
Unable to listen on port 20001: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:20001: bind: address already in use unable to create listener: Error listen tcp6 [::1]:20001: bind: address already in use]
Failed to setup port-forwarding: unable to listen on any of the requested ports: [{20001 8080}]
Unable to listen on port 20001: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:20001: bind: address already in use unable to create listener: Error listen tcp6 [::1]:20001: bind: address already in use]

Expected behavior

$ odo dev
  __
 /  \__     Developing using the "my-go-app-cluster" Devfile
 \__/  \    Namespace: default
 /  \__/    odo version: v3.9.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
 •  Waiting for Kubernetes resources  ...
 ⚠  Pod is Pending
 ✓  Pod is Running
 ✓  Syncing files into the container [122ms]
 ✓  Building your application in container (command: build) [355ms]
 •  Executing the application (command: run)  ...
 ✓  Waiting for the application to be ready [1s]
 -  Forwarding from 127.0.0.1:20002 -> 8080


↪ Dev mode
 Status:
 Watching for changes in the current directory /tmp/backend

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

Any logs, error output, etc?

This is only an issue for cluster on MacOS; it works as expected on podman for MacOS.
It works as expected for both cluster and podman on Linux.

This problem was not present in v3.8.0, and I believe I have traced the origin to 86b271d. This problem does not exist before this commit, and reverting the commit also seemed to make the problem go away for cluster, but brings it back for podman.

Workaround: Using custom port mapping for cluster can work as a workaround, but the problem still exists, i.e. it does not correctly detect free port.

Note:
This might be specific to a local K8s cluster created by docker-desktop that I am using because it appears to be working as expected for OpenShift cluster.

@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Apr 18, 2023
@valaparthvi
Copy link
Contributor Author

cc: @kadel Can you confirm if this is an issue for you since you are using MacOS?

@valaparthvi valaparthvi changed the title [MacOS] Cannot run 2 dev sessions simultaneously on a cluster [MacOS] Cannot run 2 dev sessions simultaneously on a local vanilla K8s cluster Apr 18, 2023
@valaparthvi valaparthvi changed the title [MacOS] Cannot run 2 dev sessions simultaneously on a local vanilla K8s cluster [MacOS] Cannot run 2 dev sessions simultaneously on cluster Apr 18, 2023
@valaparthvi valaparthvi added the kind/bug Categorizes issue or PR as related to a bug. label Apr 20, 2023
@valaparthvi
Copy link
Contributor Author

valaparthvi commented Apr 25, 2023

Cabal call [25th April '23]:

  • Use localhost 127.0.0.1 as a default address for podman and cluster while checking for free port
  • User can provide custom address if the need be and that should be used while checking for a free port
  • Document the behavior when using 0.0.0.0 address on MacOS and cluster

@feloy
Copy link
Contributor

feloy commented May 4, 2023

Fixed by #6766
/close

@openshift-ci
Copy link

openshift-ci bot commented May 4, 2023

@feloy: Closing this issue.

In response to this:

Fixed by #6766
/close

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.

@openshift-ci openshift-ci bot closed this as completed May 4, 2023
@github-project-automation github-project-automation bot moved this to Done ✅ in odo Project May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/*` and requires one.
Projects
Archived in project
Development

No branches or pull requests

2 participants