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

I got a panic error when executing okteto up and my resources.requests are too high #3841

Closed
ifbyol opened this issue Jul 20, 2023 · 3 comments · Fixed by #3984
Closed

I got a panic error when executing okteto up and my resources.requests are too high #3841

ifbyol opened this issue Jul 20, 2023 · 3 comments · Fixed by #3984
Assignees
Labels
bug Something isn't working keep

Comments

@ifbyol
Copy link
Member

ifbyol commented Jul 20, 2023

Describe the bug

I had deployed the go-getting-started example and modified the okteto manifest to set some requests to me dev container and when I executed okteto up I'm getting a panic error:

okteto up
 i  Using ifbyol @ xxxxxxxxx as context
 i  'go-getting-started' was already deployed. To redeploy run 'okteto deploy' or 'okteto up --deploy'
 i  Images were already built. To rebuild your images run 'okteto build' or 'okteto deploy --build'
panic: runtime error: index out of range [1] with length 0

goroutine 87 [running]:
github.com/okteto/okteto/pkg/k8s/deployments.getResourceLimitError({0xc0001d2a80, 0x75}, 0xc001d52600)
	github.com/okteto/okteto/pkg/k8s/deployments/crud.go:186 +0x3f3
github.com/okteto/okteto/pkg/k8s/deployments.CheckConditionErrors(0x3c67f30?, 0xc001c74480?)
	github.com/okteto/okteto/pkg/k8s/deployments/crud.go:158 +0x331
github.com/okteto/okteto/pkg/k8s/apps.(*DeploymentApp).CheckConditionErrors(0xc001c64198?, 0x3c43bb0?)
	github.com/okteto/okteto/pkg/k8s/apps/deployments.go:111 +0x1d
github.com/okteto/okteto/pkg/k8s/apps.GetRunningPodInLoop({0x3c43bb0, 0xc0000b0690}, 0xc001d52600, {0x3c56448, 0xc001c64198}, {0x3c67f30, 0xc001c74480})
	github.com/okteto/okteto/pkg/k8s/apps/crud.go:73 +0x107
github.com/okteto/okteto/cmd/up.(*upContext).createDevContainer(0xc0000de160, {0x3c43bb0, 0xc0000b0690}, {0x3c56448, 0xc000193e00}, 0x0)
	github.com/okteto/okteto/cmd/up/activate.go:308 +0x76d
github.com/okteto/okteto/cmd/up.(*upContext).devMode(0xc0000de160?, {0x3c43bb0, 0xc0000b0690}, {0x3c56448, 0xc000193e00}, 0x6?)
	github.com/okteto/okteto/cmd/up/activate.go:246 +0x32
github.com/okteto/okteto/cmd/up.(*upContext).activate(0xc0000de160)
	github.com/okteto/okteto/cmd/up/activate.go:138 +0xaa5
github.com/okteto/okteto/cmd/up.(*upContext).activateLoop(0xc0000de160)
	github.com/okteto/okteto/cmd/up/up.go:705 +0x296
created by github.com/okteto/okteto/cmd/up.(*upContext).start
	github.com/okteto/okteto/cmd/up/up.go:637 +0x6e5

Checking the stack trace, it seems we are trying to access to an element of an empty array. It seems the error is because the memory I specified is too high. I wasn't able to reproduce it with other examples like movies.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy go-getting-started
  2. Modify the okteto manifest to specify the following: resources.requests.cpu=200m and resources.requests.memory=10Gi
  3. Execute okteto up

Expected behavior

I shouldn't get a panic. If the operation cannot be done for whatever reason I should get a proper error message

Desktop (please complete the following information):

  • Version: 2.18.0

Additional context
N/A

@ifbyol ifbyol added the bug Something isn't working label Jul 20, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. Comment on this issue or it will be closed in 7 days

@github-actions github-actions bot added the stale label Sep 18, 2023
@ifbyol ifbyol added keep and removed stale labels Sep 19, 2023
@jLopezbarb jLopezbarb self-assigned this Sep 19, 2023
@jLopezbarb
Copy link
Contributor

jLopezbarb commented Sep 19, 2023

Hi @ifbyol, I couldn't reproduce the issue. I added the following requests to the manifest and I was able to run okteto up without a problem. Is there any cluster configuration that I need to setup in order to reproduce it?

   resources:
      requests:
        cpu: 20000m
        memory: 1000Gi

Checking the requests in the yaml I can see that we are setting them correctly

    resources:
          requests:
            cpu: "20"
            memory: 1000Gi

@ifbyol
Copy link
Member Author

ifbyol commented Sep 20, 2023

I tried to reproduced it, but I wasn't able. Anyways, given the code, it seems we are trying to get the second position of an array without checking the length, so ti can happen potentially in some scenarios. Can we some defensive programming to prevent it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keep
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants