Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

[Bug] Why are there a large number of auto-forwarded ports in the dev container #2174

Open tschaffter opened 9 months ago

tschaffter commented 9 months ago

Is there an existing issue for this?

What product(s) are you seeing the problem on?

Sage Monorepo

Current behavior

I removed all Docker artifact on the host and then rebuilt and opened the monorepo in a new dev container. VS Code is showing a large number of ports (96). Most of them are auto-forwarded and not active.

image

The following processes are using non-labeled ports:

One of the non-labelled port is also blocking AWS VPN. Closing VS Code enables the AWS VPN to connect again.

image

My guess is that these two processes starts on random ports. I think that I've also seen more than one gradle server running at a time and so the second server probably started on a different port.

Task:

Expected behavior

No response

Anything else?

No response

Commit ID

No response

Are you developing inside the dev container?

Code of Conduct

tschaffter commented 9 months ago

Closing all the non-labeled ports that are not linked to a process solved the issue with AWS VPN. So even if there are no processes listening to a port, VS Code is still forwarding it, which makes it unusable on the local host.

tschaffter commented 9 months ago

Number of ports forwarded by VS Code after several closing & opening VS Code, which automatically reopen the dev container.

Each time VS Code is started, the gradle server is listening to a different server.

tschaffter commented 9 months ago

The Angular app with SSR is starting a node process that listed to different (random?) non-labeled port:

$ nx serve-ssr openchallenges
...
base URL: http://localhost:39801

$ nx serve-ssr openchallenges
...
base URL: http://localhost:46597
image
tschaffter commented 9 months ago

Here is the port/an example of port used by AWS VPN: http://127.0.0.1:35001

tschaffter commented 9 months ago

Gradle servers

Gradle servers created by the VS Code extension use non-labelled ports. BUT the forwarded ports are removed once the server are no longer running, which is great.

image
tschaffter commented 9 months ago

Node server used by Angular app

The node server listens to what seems a random port. The port forwarded by VS Code is removed when the node server is stopped.