On large cluster: "An unexpected error occurred: 'Index was outside the bounds of the array"
PaulLemay opened this issue ยท 21 comments
Describe the bug
When loading a demo app pod in a demo-namespace, Debug (local tunnel) is working fine. The transferring that demo app pod in a cluster (i.e., 63 services and less than 250 ports open) , I get the following error:
"An unexpected error occurred: 'Index was outside the bounds of the array."
Mention the platform you are using
oss: Ubuntu 20.04
vscode: 1.85.2
To Reproduce
Steps to reproduce the behavior:
k8sBridge.zip
- Build the container
- kubectl apply -f kubernetes/app/deployment.yaml
- in vscode using Kubernetes, select namespace demo-bridge
- Services > api, select the service api-...
- Debug (local tunnel)
** See error working then try the same deployment in a large cluster namespace **
Expected behavior
Should stop on a breakpoint set in main.go.
Screenshots
If applicable, add screenshots to help explain your problem.
Logs:
2024-01-31T15:23:33.1109864Z | MindaroCli | TRACE | Remoting started listening on 57558
2024-01-31T15:23:52.5728242Z | MindaroCli | TRACE | Connection established.\n
2024-01-31T15:23:52.6284783Z | MindaroCli | ERROR | Dependency: Service Run - Port Forward {"target":null,"success":false,"duration":null,"properties":{"RequestId":"null","ClientRequestId":"null","CorrelationRequestId":"null"}}
2024-01-31T15:23:52.6290216Z | MindaroCli | ERROR | ServiceConnectCommand.ExecuteInnerAsync caught exception System.IndexOutOfRangeException: Index was outside the bounds of the array.\n at Microsoft.BridgeToKubernetes.Library.Connect.LocalEnvironmentManager.CreateEnvVariablesForK8s(WorkloadInfo workloadInfo)\n at Microsoft.BridgeToKubernetes.Library.Connect.LocalEnvironmentManager.GetLocalEnvironment(Int32 remoteAgentLocalPort, WorkloadInfo workloadInfo, Int32[] localPorts, ILocalProcessConfig localProcessConfig, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass26_0.<b__0>d.MoveNext()\n--- End of stack trace from previous location ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ManagementClientExceptionStrategy.RunWithHandlingAsync[T](Func`1 func, FailureConfig failureConfig)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.GetLocalEnvironment(Int32[] workloadLocalPorts, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action workloadStartedHandler, CancellationToken cancellationToken, IRoutingManagementClient routingManagementClient)
2024-01-31T15:23:52.6292191Z | MindaroCli | ERROR | Connect operation failed.\n
2024-01-31T15:23:52.6294432Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n
Desktop (please complete the following information):
- OS: Ununtu 20.04
Additional context
Add any other context about the problem here.
@PaulLemay Thank you for all details. Can you please also send me the logs at /tmp/Bridge\ To\ Kubernetes/
? ex: bridge-*.txt files ? I will try with your app and let you know if it's reproducible.
Hello Hariharan,
Thanks for taking the time to look at it.[
bridge.tar.gz
](url)
@PaulLemay Can we get in touch via Kubernetes slack channel to look further into this issue? Please let me know, thanks.
@hsubramanianaks do you have access to Microsoft Teams?
@PaulLemay Yes, but since this is OSS I would prefer connecting via OSS Kubernetes slack. :)
@hsubramanianaks sorry but Teams is the only tool I can use
@PaulLemay Can you do me a favor ? I can give you a VSIX with a fix and extra logs to see where exactly it happens? Can you test with your large cluster and give me the logs ? If it helps, I can get you a VSIX soon. Please let me know, thanks.
@PaulLemay Here is the VSIX to test with your large cluster? https://github.com/hsubramanianaks/vscode-bridge-to-kubernetes/releases/tag/index, please set environment variable export BRIDGE_ENVIRONMENT=dev
then launch vscode. Also please share all the logs from /tmp/Bridge To Kubernetes
ex: bridge-mindarocli-, bridge-library-. let me know how it goes. Thank you.
@PaulLemay Any update on this ? are you able to test this vsix ? Please let me know.
@hsubramanianaks I am going to try it today. If there is a special procedure to introduce it, please communicate it me.
@PaulLemay please download and install the VSIX in vscode from the above message , please close the vscode window. set the env var export BRIDGE_ENVIRONMENT=dev
and then open vscode again and try testing it. Thank you.
Ok I exported the BRIDGE_ENVIRONMENT but still have the following message:
Failed to update dependencies: invalid json response body at:
https://bridge.kubernetes.blob.core.windows.net/zipv2/1.0.202400206.1/lks.json
reason: Unexpected token in JSON at position 0
Note that this does not exists: https://bridge.kubernetes.blob.core.windows.net/zipv2/1.0.202400206.1/lks.json
@PaulLemay Apologies , I will get you another VSIX the version is wrong. Also, it should point to our dev storage account instead of production ex: https://mindaromaster.blob.core.windows.net/zipv2/lks.json. I will get a new one in sometime.
Ok ๐
@PaulLemay Sorry I take that back, version looks correct on the VSIX , if you have environment variable set correctly then it would show like below and download binaries from dev storage account instead of PROD. can you please check again ? also you need to install the VSIX from this location - https://github.com/hsubramanianaks/vscode-bridge-to-kubernetes/releases/tag/index
after you install it, in the extensions tab it should show like below.
So this is what I had when testing leading to the issue listed above.
@PaulLemay it is weird why it doesn't work for you, do you see that kubernetes status bar changes to [DEV] Kubernetes like below ? and when you click on it , it should show you a menu about the cluster.
Hello @hsubramanianaks I made some modifications re the placement and content of my launch and tasks files and it is working now.
I want to tank you this product will really help :)
@PaulLemay Can you please let me know what changes you made to launch and tasks json? also did it work with the VSIX I provided or regular one? Please let me know if the fix I made is required or not. Thank you. Also can you please share your logs in the folder /tmp/BridgeToKubernetes
?
@hsubramanianaks , From macOS Vertura 13.5, I have installed VSCode, then the VSCode use "Remote SSH" connect to a VM box. I had the same remote VM box environment as Paul VM box.
I installed the Bridge to Kubernets v2.0.120240111 on the remote ssh VSCode, and I also installed Kubernets extension on remote ssh VSCode, when I run Debug (Local Tunnel) from Kubernetes extension, I have the same following error:
===================
Connect operation failed.
Stopping workload and cleaning up...
...
An unexpected error occurred: 'Index was outside the bounds of the array.'
To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.
For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.
Can you please fix the issue for MacOS? Thank you.