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

lax port management causes confusing error messages #40

Open
mdaniel opened this issue Dec 17, 2022 · 0 comments · May be fixed by #41
Open

lax port management causes confusing error messages #40

mdaniel opened this issue Dec 17, 2022 · 0 comments · May be fixed by #41
Labels
bug Something isn't working

Comments

@mdaniel
Copy link

mdaniel commented Dec 17, 2022

Describe the bug

Because the docker run uses multiple host ports, including potentially user-declared ones from .gitpod.yml, it can easily get into a situation where they conflict. However, the reported error to the user is

time="2022-12-16T18:57:57-08:00" level=error msg="[starting] workspace image done" duration=357.860717ms failure="docker: Error response from daemon: driver failed programming external connectivity on endpoint rungp-1671245876866762152 (1d3b07052b0809dc49d4a0ae7dcdb3bfc017f706ae675a091e640ad068034768): Bind for 0.0.0.0:8080 failed: port is already allocated."

without any context of why that happened or what action the user can take to resolve it

To Reproduce
Steps to reproduce the behavior:

  1. Download or build run-gp v0.1.7
  2. Change into the suggested go-gin-app directory containing an existing .gitpod.yml
  3. Execute run-gp (optionally with a bunch of --verbose to see what's up)
  4. Observe the bad outcome because "--ide-port int port to expose open vs code server (default 8080)" and the 8080 port in .gitpod.yml collide in the docker run -p 8080:22999 ... -p 8080:8080 workspace-image:latest (it could have happened with the SSHPort, also, it just happened that the getting-started repo and the default IDEPort collided

Expected behavior

My patched version emits:

time="2022-12-16T19:08:08-08:00" level=warning msg="unable to Start Workspace: PortForwarding collision on 8080 (originally 8080) with opts.IDEPort"

because:

  • the StartWorkspace func keeps track of host port allocation and asserts they do not collide
  • the RunE go func stops swallowing err
  • I had to patch run-gp to log the docker run command to even start to investigate this bug

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • CPU: amd64
  • Browser N/A
  • Version v0.1.7

Additional context
As mentioned, I have a potential fix for this, and will try to open a PR for it later but wanted to type this up while I had all the context in front of me

mdaniel added a commit to mdaniel/run-gp that referenced this issue Dec 19, 2022
@mdaniel mdaniel linked a pull request Dec 19, 2022 that will close this issue
@pawlean pawlean added the bug Something isn't working label Dec 19, 2022
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
No open projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants