Change:
import { MainThreadTunnelServiceShape, MainContext, ExtHostContext, ExtHostTunnelServiceShape, CandidatePortSource, PortAttributesSelector, TunnelDto } from 'vs/workbench/api/common/extHost.protocol'; import { TunnelDtoConverter } from 'vs/workbench/api/common/extHostTunnelService'; import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; <del> import { IRemoteExplorerService, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT } from 'vs/workbench/services/remote/common/remoteExplorerService'; </del> <ins> import { IRemoteExplorerService, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_HYBRID, PORT_AUTO_SOURCE_SETTING_OUTPUT } from 'vs/workbench/services/remote/common/remoteExplorerService'; </ins> import { ITunnelProvider, ITunnelService, TunnelCreationOptions, TunnelProviderFeatures, TunnelOptions, RemoteTunnel, ProvidedPortAttributes, PortAttributesProvider, TunnelProtocol } from 'vs/platform/tunnel/common/tunnel'; import { Disposable } from 'vs/base/common/lifecycle'; import type { TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver';

Discussion:
Type: <bBug</ban existing remote project an embedded terminal in VSC "PORTS" tab shows 51 ports This is a vanilla-flavored nodejs service that uses one dedicated port determined by the remote environment (an AWS EC2 instance running Rocky Linux) -- and that dedicated port is not opened until the service is started. I expect at most 2-3 ports to be open at any one time. VS Code version: Code 1.88.1 (, 2024-04-10T17:41:02.734Z) OS version: WindowsNT x64 10.0. Modes: Remote OS version: Linux x64 4.18.0-477.27.1.el88.x8664 <details<summarySystem Info</summary </details<details<summaryExtensions (12)</summaryExtensionVersion ------ remote-ssh0.110.1 remote-ssh-edit0.86.0 remote-explorer0.4.3 java1.30.0 intellicode-api-usage-examples0.2.8 vscodeintellicode1.3.1 vscode-java-debug0.57.0 vscode-java-dependency0.23.6 vscode-java-pack0.26.0 vscode-java-test0.41.1 vscode-maven0.44.0 markdown-pdf1.5.0 </details<!-- generated by issue reporter --
Can you connect to your remote then share the following: the value of the setting the value of the setting A screen shot of the Ports view
I appreciate your prompt attention, thanks for looking at this. As you can see in the attached "Ports view", this morning there were 53 open ports at startup. I've attached a screenshot of the "Settings" view (searching for "remote.autoForwardPorts") and the "Ports view". I looked in the local "" (in ) and see no settings with the two names you requested. I similarly found nothing in the relevant "" file(s) on the remote server. Hopefully the attached screenshot of the "Settings" view provides the information you requested. ! Settings ! Ports view
is it possible you at some point ran something that listened on each of those ports? By default, VS Code will auto forward ports, but with the setting set to , which is what you have, we don't know when to stop forwarding the port. We also restore ports (setting ).

I think the best thing we can do is change the default for SSH for to , which will let us know when to stop forwarding. I've made the appropriate PRs to get that changed.
If something ran that was listening on those ports, it was unknown to me. I don't knowingly do anything with ports on the local (Windows 10 pro) system. I manage multiple ports on the remote system, but each has a 4-digit port number. An aspect that may be of interest is that the startup behavior seems to be specific to this remote folder (). When I use VSC to open a sibling on the remote host (), the embedded terminal shows no forwarded ports at all. Screenshots below show this behavior. ! Startup VSC on ~/tms/backend/gate ! Ports view on ~/tms/backend/gate
We restore ports based on the folder, so it makes sense that you're seeing different ports depending on which folder you have open.
Hmm. It seems likely that at some point something was running and listening on those ports, otherwise we wouldn't have found them and auto forwarded them. I think the change to use by default that I mentioned above will resolve your issue in the future, but for now, I would suggest you unforward all those ports and set to .
This issue has been closed automatically because it needs more information and has not had recent activity. See also our guidelines. Happy Coding!