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

[Lists]: list(empty) delete values will be panic #3614

Closed
GStones opened this issue Jan 26, 2024 · 3 comments · Fixed by #3615
Closed

[Lists]: list(empty) delete values will be panic #3614

GStones opened this issue Jan 26, 2024 · 3 comments · Fixed by #3615
Labels
kind/bug These are bugs.

Comments

@GStones
Copy link
Contributor

GStones commented Jan 26, 2024

SDK(sidecar)Panic 💣

How to reproduce it (as minimally and precisely as possible):

  • [FeatureFlag:CountsAndLists]
    remove Lists values when Lists empty, SDK(sidecar) will panic

Environment:

  • Agones version: 1.37.0
  • Kubernetes version (use kubectl version): 1.29
  • Install method (yaml/helm): helm
  • Troubleshooting guide log(s):
E0126 12:23:35.015025       1 runtime.go:79] Observed a panic: "makeslice: cap out of range" (runtime error: makeslice: cap out of range)
goroutine 61 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic({0x1bcfb80?, 0x22d81d0})
       /go/src/agones.dev/agones/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:75 +0x99
k8s.io/apimachinery/pkg/util/runtime.HandleCrash({0x0, 0x0, 0xc000061d30?})
       /go/src/agones.dev/agones/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:49 +0x75
panic({0x1bcfb80, 0x22d81d0})
       /usr/local/go/src/runtime/panic.go:884 +0x213
agones.dev/agones/pkg/sdkserver.deleteValues(...)
       /go/src/agones.dev/agones/pkg/sdkserver/sdkserver.go:1241
agones.dev/agones/pkg/sdkserver.(*SDKServer).updateList(0xc00077a1e0, {0x22f8000, 0xc0000ac910})
       /go/src/agones.dev/agones/pkg/sdkserver/sdkserver.go:1205 +0x40f
agones.dev/agones/pkg/sdkserver.(*SDKServer).syncGameServer(0x0?, {0x22f8000?, 0xc0000ac910?}, {0x1e90d8c?, 0xffffffffffffffff?})
       /go/src/agones.dev/agones/pkg/sdkserver/sdkserver.go:353 +0x89
agones.dev/agones/pkg/util/workerqueue.(*WorkerQueue).processNextWorkItem(0xc0000ac730, {0x22f8000, 0xc0000ac910})
       /go/src/agones.dev/agones/pkg/util/workerqueue/workerqueue.go:182 +0x274
agones.dev/agones/pkg/util/workerqueue.(*WorkerQueue).runWorker(...)
       /go/src/agones.dev/agones/pkg/util/workerqueue/workerqueue.go:158
agones.dev/agones/pkg/util/workerqueue.(*WorkerQueue).run.func1()
       /go/src/agones.dev/agones/pkg/util/workerqueue/workerqueue.go:217 +0x45
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0x30?)
       /go/src/agones.dev/agones/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:226 +0x3e
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0x17aeb16?, {0x22dfb80, 0xc000894510}, 0x1, 0xc000542ea0)
       /go/src/agones.dev/agones/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:227 +0xb6
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0x0?, 0x3b9aca00, 0x0, 0x0?, 0x0?)
       /go/src/agones.dev/agones/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:204 +0x89
k8s.io/apimachinery/pkg/util/wait.Until(...)
       /go/src/agones.dev/agones/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:161
agones.dev/agones/pkg/util/workerqueue.(*WorkerQueue).run(0xc0000ac730?, {0x22f8000?, 0xc0000ac910?})
       /go/src/agones.dev/agones/pkg/util/workerqueue/workerqueue.go:217 +0xdc
created by agones.dev/agones/pkg/util/workerqueue.(*WorkerQueue).Run
       /go/src/agones.dev/agones/pkg/util/workerqueue/workerqueue.go:206 +0x165
panic: runtime error: makeslice: cap out of range [recovered]
       panic: runtime error: makeslice: cap out of range
@GStones GStones added the kind/bug These are bugs. label Jan 26, 2024
@GStones
Copy link
Contributor Author

GStones commented Jan 27, 2024

Already resolved: #3606.
patch:func deleteValues should check capacity <0 to keep code security

@igooch
Copy link
Collaborator

igooch commented Jan 31, 2024

Thanks for the fix, although I'm surprised the list not containing the value to delete wasn't caught earlier in the code

return nil, errors.Errorf("not found. Value: %s not found in List: %s", in.Value, in.Name)
. How are you calling the list delete?

@GStones
Copy link
Contributor Author

GStones commented Feb 1, 2024

This panic happend before this PR(#3606).
updateList not clear, every loop will delete from list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug These are bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants