acs-engine icon indicating copy to clipboard operation
acs-engine copied to clipboard

panic: runtime error: index out of range

Open jalberto opened this issue 8 years ago • 19 comments

@jackfrancis I think this one is for you:

acs-engine 0.15.1

❯ acs-engine scale \                           
  --subscription-id foo \                                     
  --deployment-dir ./_output/foo \         
  --location westeurope \                      
  --resource-group foo \                   
  --new-node-count 3 --node-pool pool01 --master-FQDN foo.westeurope.cloudapp.azure.com                                                                                                   
INFO[0000] validating...                                                                       
INFO[0008] Name suffix: 26941526                                                               
panic: runtime error: index out of range       

goroutine 1 [running]:                         
github.com/Azure/acs-engine/cmd.(*scaleCmd).run(0xc420064600, 0xc4207bed80, 0xc4205700e0, 0x0, 0xe, 0x0, 0x0)                                                                                 
        /Users/jackfrancis/work/src/github.com/Azure/acs-engine/cmd/scale.go:219 +0x25c9       
github.com/Azure/acs-engine/cmd.newScaleCmd.func1(0xc4207bed80, 0xc4205700e0, 0x0, 0xe, 0x0, 0x0)                                                                                             
        /Users/jackfrancis/work/src/github.com/Azure/acs-engine/cmd/scale.go:66 +0x52          
github.com/Azure/acs-engine/vendor/github.com/spf13/cobra.(*Command).execute(0xc4207bed80, 0xc420570000, 0xe, 0xe, 0xc4207bed80, 0xc420570000)                                                
        /Users/jackfrancis/work/src/github.com/Azure/acs-engine/vendor/github.com/spf13/cobra/command.go:647 +0x3f1                                                                           
github.com/Azure/acs-engine/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4207be000, 0xc4207bed80, 0xc4207beb40, 0xc4207be900)                                                         
        /Users/jackfrancis/work/src/github.com/Azure/acs-engine/vendor/github.com/spf13/cobra/command.go:726 +0x2fe                                                                           
github.com/Azure/acs-engine/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4207be000, 0xc42000c018, 0x0)                                                                                 
        /Users/jackfrancis/work/src/github.com/Azure/acs-engine/vendor/github.com/spf13/cobra/command.go:685 +0x2b                                                                            
main.main()                                    
        /Users/jackfrancis/work/src/github.com/Azure/acs-engine/main.go:12 +0x74 

jalberto avatar Apr 10 '18 10:04 jalberto

@jalberto is this on a cluster with Windows nodes? Scale isn't supported on Windows yet... See #1972

CecileRobertMichon avatar Apr 10 '18 16:04 CecileRobertMichon

@CecileRobertMichon nope, not windows at all. Even if it had any windows node.., that error is a panic not an error message

jalberto avatar Apr 10 '18 17:04 jalberto

Alright I will look into it when I get the chance. Please send me your apimodel. Did you run an upgrade on the cluster before scaling?

CecileRobertMichon avatar Apr 10 '18 19:04 CecileRobertMichon

No upgrade, just scale. Judging by the panic I pasted is a deeper problem, a command like this should never throw a panic, but a descriptive error message.

{
  "apiVersion": "vlabs",
  "properties": {
    "orchestratorProfile": {
      "orchestratorType": "Kubernetes",
      "orchestratorRelease": "1.9",
      "kubernetesConfig": {
        "networkPolicy": "azure",
        "maxPods": 50
      }
    },
    "masterProfile": {
      "vnetSubnetId": "",
      "firstConsecutiveStaticIP": "10.255.255.5",
      "vnetCidr": "10.192.0.0/10",
      "count": 3,
      "dnsPrefix": "",
      "vmSize": "Standard_D2_v2"
    },
    "agentPoolProfiles": [
      {
        "name": "pool01",
        "vnetSubnetId": "",
        "count": 3,
        "vmSize": "Standard_DS4_v2",
        "availabilityProfile": "AvailabilitySet",
        "storageProfile" : "ManagedDisks"
      }
    ],
    "linuxProfile": {
      "adminUsername": "",
      "ssh": {
        "publicKeys": [
          {
            "keyData": ""
          }
        ]
      }
    },
    "servicePrincipalProfile": {
      "clientId": "",
      "secret": ""
    }
  }
}

jalberto avatar Apr 11 '18 08:04 jalberto

@CecileRobertMichon any progress? Did you find out why is that panic happening?

jalberto avatar Apr 12 '18 09:04 jalberto

@jalberto not yet, I didn't have time to look at this yesterday. I completely agree with you that we should never throw a panic but rather catch it and return a descriptive error message. #2059 was merged a while back to address the same panic that was reported on a windows cluster, we need to understand why it is happening in your situation and not being caught. In my previous experience, the panic was happening because the length of vms returned was 0 at https://github.com/Azure/acs-engine/blob/0ddf1987197d710bbec8531720ded83f11034849/cmd/scale.go#L194

CecileRobertMichon avatar Apr 12 '18 15:04 CecileRobertMichon

I have the same experience here trying to scale our clusters. Kubernetes 1.9.2, acs-engine 0.15.1

ghost avatar Apr 12 '18 17:04 ghost

@jalberto @neurot1cal what does kubectl get nodes output look like on the cluster you are trying to scale?

CecileRobertMichon avatar Apr 12 '18 18:04 CecileRobertMichon

every node is ready

jalberto avatar Apr 13 '18 08:04 jalberto

i have the same problem, Kubernetes v1.7.9, acs-engine v0.12.5

bailantaotao avatar Apr 21 '18 09:04 bailantaotao

Same issue with Kubernetes v1.9.3, acs engine 0.13.0 (tested also with 0.15.2)

ralbon avatar Apr 23 '18 10:04 ralbon

@CecileRobertMichon any progress in last 11days?

jalberto avatar Apr 23 '18 10:04 jalberto

@CecileRobertMichon Sorry somehow missed this, here's the output of kubectl get nodes;

NAME                        STATUS    ROLES     AGE       VERSION
33247k8s9010                Ready     <none>    49d       v1.9.3
33247k8s9011                Ready     <none>    49d       v1.9.3
33247k8s9012                Ready     <none>    49d       v1.9.3
33247k8s9013                Ready     <none>    49d       v1.9.3
33247k8s9014                Ready     <none>    49d       v1.9.3
33247k8s9015                Ready     <none>    49d       v1.9.3
33247k8s9016                Ready     <none>    49d       v1.9.3
33247k8s9017                Ready     <none>    49d       v1.9.3
33247k8s9018                Ready     <none>    49d       v1.9.3
33247k8s9019                Ready     <none>    49d       v1.9.3
k8s-linuxpool1-33247490-0   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-1   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-2   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-3   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-4   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-5   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-6   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-7   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-8   Ready     agent     49d       v1.9.3
k8s-linuxpool1-33247490-9   Ready     agent     49d       v1.9.3
k8s-master-33247490-0       Ready     master    49d       v1.9.3
k8s-master-33247490-1       Ready     master    49d       v1.9.3
k8s-master-33247490-2       Ready     master    49d       v1.9.3

ghost avatar Apr 23 '18 16:04 ghost

@neurot1cal this looks like a Windows cluster... Scale wasn't supported for windows agent pools last time I checked (TODO: make sure we have documentation that explicitly says this and return a better error message, definitely not a nil panic).

@jalberto I haven’t been able to repro yet, I will make sure this gets prioritized this week.

CecileRobertMichon avatar Apr 24 '18 01:04 CecileRobertMichon

I did some tests with the apimodel @jalberto provided and it is working as expected with latest acs-engine version (v0.16.0).

It is also working in hybrid clusters ( only for Linux Agent Pools as scaling Windows Pool is not supported yet #1972 )

@jalberto if you still have problems with latest acs-engine, could you please tell the total number of VMs you have in that resource group?

danigian avatar Apr 26 '18 23:04 danigian

Just for information, I found my error which was related to the "nameSuffix". That may be not your case but we had a similar output error.

Configuration :

  • Kubernetes 1.9.6
  • ACS Engine 0.16.2

With my team, we modify "nameSuffix" value in the azuredeploy.json file in order to have friendly name for our virtual machine (following regexp 0-9a-fA-F{8})

When we tried to scale, we had this error :

INFO[0000] validating...                                
INFO[0002] Name suffix: dev                             
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/Azure/acs-engine/cmd.(*scaleCmd).run(0xc420061b00, 0xc4205238c0, 0xc420358f00, 0x0, 0x14, 0x0, 0x0)
	/Users/jackfrancis/work/src/github.com/Azure/acs-engine/cmd/scale.go:219 +0x25c9

After investigation in ACS Engine source code, we found that the code is using a regexp k8sLinuxVMNamingFormat = "^[0-9a-zA-Z]{3}-(.+)-([0-9a-fA-F]{8})-{0,2}([0-9]+)$" which have 8 characters for nameSuffix. So it could find our nameSuffix.

Workaround : we use an 8 characters string for nameSuffix that follow the regexp.

Thanks @d-matt

ralbon avatar May 18 '18 15:05 ralbon

@CecileRobertMichon why you closed this? what is the fix? How will avoided to happen in the future?

If you closed this because of @ralbon comment, that not my case, I didn't modify nameSuffix.

@danigian I cannot upgrade acs-engine because each time I do it, it breaks my production cluster, so I will not do it again.

I am very unhappy in how you have deal with this issue. @CecileRobertMichon can you reopen this or at least explain to me how my problem is solved?

jalberto avatar Jun 05 '18 08:06 jalberto

@jalberto I closed this after https://github.com/Azure/acs-engine/pull/2859 was merged. v0.18.0 will be released soon with the fix, please let me know if you still see the issue.

CecileRobertMichon avatar Jun 05 '18 16:06 CecileRobertMichon

thanks @CecileRobertMichon will be great to mention the reason to close an issue before closing it :) anyhow, Will be this fix backported? I don't feel comfortable upgrading acs (each time I run a new acs version something breaks)

jalberto avatar Jun 06 '18 09:06 jalberto