microsoft / microsoft/vscode-remote-release

[Remote-Tunnels] Cannot connect to tunnel (error: "Tunnel connection closed undefined")

Open
#10,172 0 comments 3 reactions 1 assignee View on GitHub

@connor4312 is already working on this.

Since Aug 28, 2024.

bug tunnels
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • Local VSCode Version: 1.92.2
  • Local OS Version: Win10 Pro
  • Remote OS Version: Ubuntu 22.04 x64
  • Remote VS Code CLI Version: 1.92.2
  • Remote Extension/Connection Type: Remote - Tunnels v1.5.2

Steps to Reproduce:

  1. created the Azure VM Ubuntu 22.04 LTS. My understanding of the MS Dev Tunnels is that only the outbound connection is needed, thus this VM does not have a public IP (later on I verified that after public access is enabled the behaviour is exactly the same as below regardless of inbound/outbound rules).
  2. on remote: sudo curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz
  3. unpack, etc.
  4. code tunnel --verbose --name myname
  5. Login via Microsoft Account. (Later on I tested the GitHub account authorization and the effect is the same)
  6. Logs:
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2024-08-16 14:08:05] debug Starting tunnel with `code code tunnel --verbose --name myname`
[2024-08-16 14:08:05] debug starting as new singleton
[2024-08-16 14:08:05] debug Found a persisted tunnel, seeing if the name matches...
[2024-08-16 14:08:05] debug Using file keychain storage due to: user prefers file storage:
[2024-08-16 14:08:05] trace Found token in keyring
[2024-08-16 14:08:05] debug [reqwest::connect] starting new connection: https://euw.rel.tunnels.api.visualstudio.com/
[2024-08-16 14:08:05] debug Tunnel name changed, applying updates...
[2024-08-16 14:08:05] trace Found token in keyring
[2024-08-16 14:08:05] trace Found token in keyring
[2024-08-16 14:08:06] debug Starting tunnel to server...
[2024-08-16 14:08:06] trace Found token in keyring
[2024-08-16 14:08:06] debug [tungstenite::handshake::client] Client handshake done.
[2024-08-16 14:08:06] debug [russh::ssh_read] read_ssh_id: reading
[2024-08-16 14:08:06] debug [russh::ssh_read] read 39
[2024-08-16 14:08:06] debug [russh::ssh_read] Ok("SSH-2.0-Microsoft.DevTunnels.Ssh_3.11\r\n")
[2024-08-16 14:08:06] debug [russh::client] writing 352 bytes
[2024-08-16 14:08:06] debug [russh::ssh_read] id 39 39
[2024-08-16 14:08:06] debug [russh::client::kex] extending []
[2024-08-16 14:08:06] debug [russh::client::kex] algo = Names { kex: Name("none"), key: Name("none"), cipher: Name("none"), client_mac: Name("none"), server_mac: Name("none"), server_compression: None, client_compression: None, ignore_guessed: false }
[2024-08-16 14:08:06] debug [russh::client::kex] write = []
[2024-08-16 14:08:06] debug [russh::client::kex] i0 = 342
[2024-08-16 14:08:06] debug [russh::client::kex] moving to kexdhdone, exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, server_id: CryptoVec { p: <ADDRESS>, size: 37, capacity: 64 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 342, capacity: 512 }, server_kex_init: CryptoVec { p: <ADDRESS>, size: 94, capacity: 128 }, client_ephemeral: CryptoVec { p: 0x1, size: 0, capacity: 0 }, server_ephemeral: 
CryptoVec { p: 0x1, size: 0, capacity: 0 } }
[2024-08-16 14:08:06] debug [tunnels::connections::relay_tunnel_host] established host relay primary session
[2024-08-16 14:08:06] trace Found token in keyring
[2024-08-16 14:08:06] debug Connected to tunnel endpoint: TunnelRelayTunnelEndpoint { base: TunnelEndpoint { id: "<ID>-relay", connection_mode: TunnelRelay, host_id: "<ID>", host_public_keys: [], port_uri_format: Some("https://<ID>-{port}.euw.devtunnels.ms/"), tunnel_uri: Some("https://<ID>.euw.devtunnels.ms/"), port_ssh_command_format: Some("ssh <ID>-{port}@ssh.euw.devtunnels.ms"), tunnel_ssh_command: Some("ssh <ID>@ssh.euw.devtunnels.ms"), ssh_gateway_public_key: None }, host_relay_uri: Some("wss://euw-data.rel.tunnels.api.visualstudio.com/api/v1/Host/Connect/joyful-hill-<ID>"), client_relay_uri: Some("wss://euw-data.rel.tunnels.api.visualstudio.com/api/v1/Client/Connect/joyful-hill-<ID>") }
[2024-08-16 14:08:06] debug Visual Studio Code Server is listening for incoming connections

Open this link in your browser https://vscode.dev/tunnel/myname

[2024-08-16 14:08:06] trace Found token in keyring

So far so good, I thought - let's connect into that tunnel!

  1. On local machine open the VSCode, press Connect to tunnel (connecting via https://vscode.dev/tunnel/myname gives same results)
  2. Login to Microsoft account
  3. The myname tunnel is listed and state is running
  4. Try to connect.
  5. Then this happens after 5 seconds:
    image
  6. The devtools logs:
    image
    image
  7. Remote machine logs:
[2024-08-16 14:08:35] debug [russh::client::encrypted] confirming channel: OpenChannelMessage { typ: Unknown { typ: [99, 108, 105, 101, 110, 116, 45, 115, 115, 104, 45, 115, 101, 115, 115, 105, 111, 110, 45, 115, 116, 114, 101, 97, 109] }, recipient_channel: 0, recipient_window_size: 5242880, recipient_maximum_packet_size: 32768 }
[2024-08-16 14:08:35] info [tunnels::connections::relay_tunnel_host] Opened new client on channel 2
[2024-08-16 14:08:35] debug [tunnels::connections::relay_tunnel_host] starting to serve host relay client session
[2024-08-16 14:08:35] info [russh::server] wrote id
[2024-08-16 14:08:35] debug [russh::ssh_read] read_ssh_id: reading
[2024-08-16 14:08:35] debug [russh::client::encrypted] channel_window_adjust
[2024-08-16 14:08:35] debug [russh::client::encrypted] amount: 4194326
[2024-08-16 14:08:35] debug [russh::ssh_read] read 33
[2024-08-16 14:08:35] debug [russh::ssh_read] Ok("SSH-2.0-dev-tunnels-ssh_3.11.36\r\n")
[2024-08-16 14:08:35] debug [russh::server::kex] server kex init: [20, 134, 137, 77, 136, 82, 41, 203, 167, 177, 125, 110, 251, 90, 119, 233, 86, 0, 0, 0, 95, 100, 105, 102, 102, 105, 101, 45, 104, 101, 108, 108, 109, 97, 110, 45, 103, 114, 111, 117, 112, 49, 52, 45, 115, 104, 97, 50, 

...deleted some lines...

, 110, 111, 110, 101, 0, 0, 0, 26, 122, 108, 105, 98, 44, 122, 108, 105, 98, 64, 111, 112, 101, 110, 115, 115, 104, 46, 99, 111, 109, 44, 110, 111, 110, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[2024-08-16 14:08:35] info [russh::server] read other id
[2024-08-16 14:08:35] info [russh::server] session is running
[2024-08-16 14:08:35] debug [russh::ssh_read] id 33 33
[2024-08-16 14:08:37] debug [russh::server::kex] server kexdhdone.exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 31, capacity: 32 
}, server_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 453, capacity: 512 }, server[2024-08-16 14:08:35] info [russh::server] read other id
[2024-08-16 14:08:35] info [russh::server] session is running
[2024-08-16 14:08:35] debug [russh::ssh_read] id 33 33
[2024-08-16 14:08:37] debug [russh::server::kex] server kexdhdone.exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 31, capacity: 32 
}, server_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 453, capacity: 512 }, server_kex_init: CryptoVec { p: <ADDRESS>, size: 554, capacity: 1024 }, client_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 }, server_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 } }
[2024-08-16 14:08:37] debug [russh::server::kex] exchange hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] signing with key 0
[2024-08-16 14:08:37] debug [russh::server::kex] hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] key: RSA { (hidden) }
[2024-08-16 14:08:37] debug [russh::server::encrypted] request: Ok("ssh-userauth")
[2024-08-16 14:08:35] info [russh::server] read other id
[2024-08-16 14:08:35] info [russh::server] session is running
[2024-08-16 14:08:35] debug [russh::ssh_read] id 33 33
[2024-08-16 14:08:37] debug [russh::server::kex] server kexdhdone.exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 31, capacity: 32 
}, server_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 453, capacity: 512 }, server_kex_init: CryptoVec { p: <ADDRESS>, size: 554, capacity: 1024 }, client_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 }, server_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 } }
[2024-08-16 14:08:37] debug [russh::server::kex] exchange hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] signing with key 0
[2024-08-16 14:08:37] debug [russh::server::kex] hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:35] info [russh::server] read other id
[2024-08-16 14:08:35] info [russh::server] session is running
[2024-08-16 14:08:35] debug [russh::ssh_read] id 33 33
[2024-08-16 14:08:37] debug [russh::server::kex] server kexdhdone.exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 31, capacity: 32 
}, server_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 453, capacity: 512 }, server_kex_init: CryptoVec { p: <ADDRESS>, size: 554, capacity: 1024 }, client_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 }, serve[2024-08-16 14:08:35] info [russh::server] session is running
[2024-08-16 14:08:35] debug [russh::ssh_read] id 33 33
[2024-08-16 14:08:37] debug [russh::server::kex] server kexdhdone.exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 31, capacity: 32 
}, server_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 453, capacity: 512 }, server[2024-08-16 14:08:37] debug [russh::server::kex] server kexdhdone.exchange = Exchange { client_id: CryptoVec { p: <ADDRESS>, size: 31, capacity: 32 
}, server_id: CryptoVec { p: <ADDRESS>, size: 20, capacity: 32 }, client_kex_init: CryptoVec { p: <ADDRESS>, size: 453, capacity: 512 }, server_kex_init: CryptoVec { p: <ADDRESS>, size: 554, capacity: 1024 }, client_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 }, server_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 } }
[2024-08-16 14:08:37] debug [russh::server::kex] exchange hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] signing with key 0
[2024-08-16 14:08:37] debug [russh::server::kex] hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] key: RSA { (hidden) }
[2024-08-16 14:08:37] debug [russh::server::encrypted] request: Ok("ssh-userauth")
[2024-08-16 14:08:37] debug [russh::server::encrypted] name: "tunnel" Ok("ssh-connection") Ok("none")
[2024-08-16 14:08:37] debug [tunnels::connections::relay_tunnel_host] host relay client session successfully authed
_kex_init: CryptoVec { p: <ADDRESS>, size: 554, capacity: 1024 }, client_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 }, server_ephemeral: CryptoVec { p: <ADDRESS>, size: 256, capacity: 256 } }
[2024-08-16 14:08:37] debug [russh::server::kex] exchange hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] signing with key 0
[2024-08-16 14:08:37] debug [russh::server::kex] hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] key: RSA { (hidden) }
[2024-08-16 14:08:37] debug [russh::server::encrypted] request: Ok("ssh-userauth")
[2024-08-16 14:08:37] debug [russh::server::encrypted] name: "tunnel" Ok("ssh-connection") Ok("none")
[2024-08-16 14:08:37] debug [tunnels::connections::relay_tunnel_host] host relay client session successfully authed
[2024-08-16 14:08:37] debug [russh::server::kex] hash: CryptoVec { p: <ADDRESS>, size: 32, capacity: 32 }
[2024-08-16 14:08:37] debug [russh::server::kex] key: RSA { (hidden) }
[2024-08-16 14:08:37] debug [russh::server::encrypted] request: Ok("ssh-userauth")
[2024-08-16 14:08:37] debug [russh::server::encrypted] name: "tunnel" Ok("ssh-connection") Ok("none")
[2024-08-16 14:08:37] debug [tunnels::connections::relay_tunnel_host] host relay client session successfully authed
[2024-08-16 14:08:37] debug [rpc.0] Serving new connection

[2024-08-16 14:08:37] debug [russh::server::encrypted] name: "tunnel" Ok("ssh-connection") Ok("none")
[2024-08-16 14:08:37] debug [tunnels::connections::relay_tunnel_host] host relay client session successfully authed
[2024-08-16 14:08:37] debug [rpc.0] Serving new connection


[2024-08-16 14:08:37] debug [rpc.0] Serving new connection
  1. Afterwards once I press Close tunnel then I see this on remote host:
[2024-08-16 14:09:37] info [rpc.0] Disposed of connection to running server.

Basically no errors are shown on the remote.

Guys, where to start an investigation? What am I doing wrong?

Does this issue occur when you try this locally?: What does locally mean in here?
Does this issue occur when you try this locally and all extensions are disabled?: Haven't verified yet
https://code.visualstudio.com/insiders/ gives similar result.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.