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

'Attach Visual Studio Code' does nothing, throws no error, no logging #5100

Closed
andyljones opened this issue May 26, 2021 · 19 comments
Closed
Assignees
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@andyljones
Copy link

andyljones commented May 26, 2021

  • VSCode Version: 1.56.2
  • Local OS Version: macOS Big Sur
  • Remote OS Version: Ubuntu 18.04.5 LTS
  • Remote Extension/Connection Type: Kubernetes
  • Logs: None

Steps to Reproduce:

  1. Open the Kubernetes UI, right click on a pod, 'Attach Visual Studio Code'.
  2. The 'Activating Extensions' busy icon shows up for a few seconds, then nothing happens.
  3. Nothing shows up in the vscode dev console, nothing shows up in any of the output panes. None of the 'Remote-container: show log' commands seem to do anything. No 'remote extension host' output channel.

Does this issue occur when you try this locally?: N/A
Does this issue occur when you try this locally and all extensions are disabled?: N/A, can't do this with no Kubernetes extension

I suspect there might be a million reasons for this, and I'm working in a 'heavy' environment that'd be difficult to offer you a minimal reproduction for. So rather than giving you every detail of my setup, I think it's better to ask: how'd I go about getting enough information to isolate the problem? I haven't spotted any obvious log level settings.

(Aside: I saw something somewhere that said the 'Attach Visual Studio Code' menu entry is your folks' turf rather than the vscode-kubernetes-tools folks', but say if I've got that wrong)

@github-actions github-actions bot added the containers Issue in vscode-remote containers label May 26, 2021
@chrmarti
Copy link
Contributor

Is there anything in F1 > Remote-Containers: Show Container Log?

@chrmarti chrmarti self-assigned this May 27, 2021
@chrmarti chrmarti added the info-needed Issue requires more information from poster label May 27, 2021
@andyljones
Copy link
Author

That command doesn't appear to do anything (3. above). There's no appropriately-named option in the Output dropdown either.

@chrmarti
Copy link
Contributor

Is there anything in the Extension Host output channel? It sounds like the extension might fail to activate, but that would usually show an error notification.

@andyljones
Copy link
Author

andyljones commented May 31, 2021

On launching vscode, there's a bunch of loads and activations in that channel, with the two remote-related lines being

[2021-05-31 13:23:36.813] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers {"startup":false,"extensionId":{"value":"ms-vscode-remote.remote-containers","_lower":"ms-vscode-remote.remote-containers"},"activationEvent":"onStartupFinished"}
[2021-05-31 13:23:36.813] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/andy/.vscode/extensions/ms-vscode-remote.remote-containers-0.177.2/dist/extension/extension

When I click on the Kubernetes icon on the LHS, there're a few more:

[2021-05-31 13:26:12.867] [exthost] [info] ExtensionService#_doActivateExtension redhat.vscode-yaml {"startup":false,"extensionId":{"value":"ms-kubernetes-tools.vscode-kubernetes-tools","_lower":"ms-kubernetes-tools.vscode-kubernetes-tools"},"activationEvent":"onView:extension.vsKubernetesExplorer"}
[2021-05-31 13:26:12.867] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/andy/.vscode/extensions/redhat.vscode-yaml-0.19.2/out/src/extension
[2021-05-31 13:26:12.964] [exthost] [info] ExtensionService#_doActivateExtension ms-kubernetes-tools.vscode-kubernetes-tools {"startup":false,"extensionId":{"value":"ms-kubernetes-tools.vscode-kubernetes-tools","_lower":"ms-kubernetes-tools.vscode-kubernetes-tools"},"activationEvent":"onView:extension.vsKubernetesExplorer"}
[2021-05-31 13:26:12.964] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/andy/.vscode/extensions/ms-kubernetes-tools.vscode-kubernetes-tools-1.3.3/dist/extension
[2021-05-31 13:26:13.201] [exthost] [warning] [redhat.vscode-yaml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[yaml]', provide the URI of a resource or 'null' for any resource.

But expanding the 'pods' list and clicking 'Attach to Visual Studio Code' generates no further logs; just the 'Activating Extensions' spinner in the status bar for a few seconds then nothing.

@andyljones
Copy link
Author

Is this pretty much DOA then - you've not seen anything like this, and there's no way for me to get more information on what's causing the behaviour?

@caesarnine
Copy link

I'm having the same issue. When I've setup the Kubernetes extension locally I get the following error when trying to Attach to a running pod:

error running command remote-containers.attachToK8sContainerFromViewlet: Running the contributed command: 'remote-containers.attachToK8sContainerFromViewlet' failed.. This is likely caused by the extension that contributes remote-containers.attachToK8sContainerFromViewlet.

When I'm SSHed into a server and try the same via the Kubernetes extension in that window I don't receive an error message, and nothing happens. I can use the Kubernetes extension normally otherwise (so start a terminal, view logs, etc).

@caesarnine
Copy link

I just got it working for me - the logs were showing this

[2021-06-22T16:41:34.250Z] Start: Run: kubectl config current-context
[2021-06-22T16:41:34.298Z] Stop (48 ms): Run: kubectl config current-context

and in my case I'm using EKS so I ran the following

aws eks update-kubeconfig --name <insert_cluster_name>

and now the Attach context menu item works.

@chrmarti
Copy link
Contributor

Is there a better way to determine which cluster is shown in the Kubernetes viewlet than kubectl config current-context?

@adambozson
Copy link

@caesarnine Which logs? I'm getting the same behaviour - works locally but silent failure when I try in a remote SSH session.

Running aws eks update-kubeconfig --name <insert_cluster_name> does not solve it for me.

@chrmarti
Copy link
Contributor

Attaching to a Kubernetes pod while connected with Remote-SSH is currently not supported. I'll make sure the action is not show in the context menu in this case.

@andyljones
Copy link
Author

andyljones commented Aug 31, 2021

I think that @caesarnine 's error is subtly different from the one @adambozson and I are seeing. I still am not getting any logs at all, and it's not fixed by update-kubeconfig.

Adam, here are some less-than-usual things about my setup - mind telling me if you match on any?

@chrmarti
Copy link
Contributor

chrmarti commented Sep 1, 2021

@andyljones How are you connecting to AWS? Are you in a local VS Code window when you run Attach Visual Studio Code?

@andyljones
Copy link
Author

andyljones commented Sep 1, 2021

Yes, I'm in a local VS Code window. I'm connecting through a script that starts with SSO and ends with a bunch of kubectl port forward, kubectl exec and kubectl cp commands to control the remote box.

For reference, the other commands in the Kubernetes right-click menu work - like get or port forward - work fine.

@chrmarti
Copy link
Contributor

chrmarti commented Sep 9, 2021

Adding logging to help track this down. (Will be in the next version for VS Code Insiders.)

@chrmarti chrmarti reopened this Sep 9, 2021
@andyljones
Copy link
Author

Still nothing. Same extension host logs as before, same spinner when I 'Attach Visual Studio Code', and no further logs to go with it. Insiders version

Version: 1.61.0-insider (Universal)
Commit: 0884da1650baa24994d23d2a3742823c1186e526
Date: 2021-09-10T08:15:58.143Z (6 hrs ago)
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 20.6.0

I suspect this might be hard to believe, so I've attached a little vid so we can see if I'm doing anything daft.

output.mp4

And here are the logs that are present, all of which appear before clicking 'Attach Visual Studio Code':

[2021-09-10 15:50:33.751] [exthost] [info] extension host started
[2021-09-10 15:50:33.751] [exthost] [info] Skipping acquiring lock for /Users/andy/Library/Application Support/Code - Insiders/User/workspaceStorage/3714ed85a38aa737fb7f4c4da0b79845.
[2021-09-10 15:50:33.770] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"}
[2021-09-10 15:50:33.770] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/microsoft-authentication/dist/extension.js
[2021-09-10 15:50:33.791] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"}
[2021-09-10 15:50:33.791] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/debug-auto-launch/dist/extension
[2021-09-10 15:50:33.792] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-09-10 15:50:33.792] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/main
[2021-09-10 15:50:33.859] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"}
[2021-09-10 15:50:33.859] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js
[2021-09-10 15:50:33.971] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"}
[2021-09-10 15:50:33.988] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/github-authentication/dist/extension.js
[2021-09-10 15:50:34.042] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-09-10 15:50:34.042] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/github/dist/extension.js
[2021-09-10 15:50:34.048] [exthost] [info] eager extensions activated
[2021-09-10 15:50:34.049] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":false,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"onStartupFinished"}
[2021-09-10 15:50:34.049] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/emmet/dist/node/emmetNodeMain
[2021-09-10 15:50:34.057] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":false,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"onStartupFinished"}
[2021-09-10 15:50:34.057] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/merge-conflict/dist/mergeConflictMain
[2021-09-10 15:50:34.059] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers {"startup":false,"extensionId":{"value":"ms-vscode-remote.remote-containers","_lower":"ms-vscode-remote.remote-containers"},"activationEvent":"onStartupFinished"}
[2021-09-10 15:50:34.059] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/andy/.vscode-insiders/extensions/ms-vscode-remote.remote-containers-0.194.0/dist/extension/extension
[2021-09-10 15:50:35.995] [exthost] [info] ExtensionService#_doActivateExtension redhat.vscode-yaml {"startup":false,"extensionId":{"value":"ms-kubernetes-tools.vscode-kubernetes-tools","_lower":"ms-kubernetes-tools.vscode-kubernetes-tools"},"activationEvent":"onView:extension.vsKubernetesExplorer"}
[2021-09-10 15:50:35.995] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/andy/.vscode-insiders/extensions/redhat.vscode-yaml-0.22.0/out/src/extension
[2021-09-10 15:50:36.156] [exthost] [info] ExtensionService#_doActivateExtension ms-kubernetes-tools.vscode-kubernetes-tools {"startup":false,"extensionId":{"value":"ms-kubernetes-tools.vscode-kubernetes-tools","_lower":"ms-kubernetes-tools.vscode-kubernetes-tools"},"activationEvent":"onView:extension.vsKubernetesExplorer"}
[2021-09-10 15:50:36.156] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/andy/.vscode-insiders/extensions/ms-kubernetes-tools.vscode-kubernetes-tools-1.3.3/dist/extension
[2021-09-10 15:50:36.406] [exthost] [warning] [redhat.vscode-yaml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[yaml]', provide the URI of a resource or 'null' for any resource.

@chrmarti
Copy link
Contributor

@andyljones Could you retry with Remote-Containers 0.195.0 and check the container log (F1 > Remote-Containers: Show Container Log)?

@andyljones
Copy link
Author

andyljones commented Sep 15, 2021

Updated to 0.195.0 and tried F1 > Remote-Containers: Show Container Log; the show container log command itself triggers the same 'Activating Extension' spinner for a few seconds and then nothing happens. No log window appears.

e: I've just noticed that the 'Runtime Status' page of Remote - Containers shows as 'Not yet activated', and going to the Remote Explorer the containers spinner runs permanently. I wonder if this something about my Docker install. Let me try some experiments...

@andyljones
Copy link
Author

andyljones commented Sep 15, 2021

b i n g o

I had $DOCKER_HOST set to a dead URL, so every docker command was hanging indefinitely. Presumably 'run docker' happens somewhere very early in the Remote-Containers extension setup, before it gets to logging anything.

A minimal example is

export DOCKER_HOST=ssh://bad@url.local 
docker

which hangs on my Mac. Have that variable set somewhere that vscode can see it and loading the extension (presumably) times out and fails.

Anyway now I've removed that line from my zshrc, Attach works fine! Thanks so much for your patience!

@andyljones
Copy link
Author

And just checked my ps -ef | grep ssh locally for another reason and I've found a bunch of hanging

ssh -l ajones -- aj-server.local docker system dial-stdio

calls, which I reckon are the root of this.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants