-
Notifications
You must be signed in to change notification settings - Fork 813
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
fix(SdkList): fix list delete values panic #3615
fix(SdkList): fix list delete values panic #3615
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Build Succeeded 👏 Build Id: d5214018-41c1-43ef-be5b-1f278643961c The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Failed 😱 Build Id: 406745f3-3460-459c-a5e6-5b348ebfd0bd To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
I saw that issue as well, as you said it's fixed by the other mr, I would say that it's still dangerous to have possible negative capacity so it should be fixed however I'm not sure there is a real performance improvement by trying to prealocate the map. |
Here is preallocate a slice, I think it can be removed,because the list max available is 1000, slice grow has limit(1024). |
pkg/sdkserver/sdkserver.go
Outdated
for i, val := range valuesList { | ||
if _, ok := toDeleteValues[val]; !ok { | ||
newList = append(newList, valuesList[i]) | ||
newValuesList := make([]string, 0, len(valuesList)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly easier suggestion for defensive programming.
newValuesList := make([]string, 0, len(valuesList)) | |
newLen = len(valuesList)-len(toDeleteValues) | |
if newLen < 0 { | |
newLen = 0 | |
} | |
newList := make([]string, 0, newLen) |
And then we continue on as before.
Or I think as you said, make newValueList := []string{}
and let it expand naturally - which is a bit more readable IMHO, but I don't have strong opinions about either approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestions! Already fixed, please review
…gones into fix-list-remove-values
Build Failed 😱 Build Id: 6fca4e56-da57-434a-a57f-5d90dea4f9bd To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
I see this failure in the unit tests:
Do you see the same thing locally, or is this a flake? |
…gones into fix-list-remove-values
Build Failed 😱 Build Id: fd39d453-c4c3-42b3-9f3a-f0a1c3d1c562 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Looks like this flake is hitting us hard. We should dig into this one @igooch |
Okay I can at least replicate this! It's going to only happen under load. So to replicate, we drop in a
/cc @igooch in case you see something I'm missing. |
Got it! Fixed. PR incoming shortly. |
Whoops, was writing comments on the wrong issue! 🤦🏻 Either way #3627 will fix the flake. |
Build Succeeded 👏 Build Id: 4fded0b4-d6e3-455d-816e-ace22f645b32 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
What type of PR is this?
/kind bug
What this PR does / Why we need it:
It will make Sdk sidecar panic
Which issue(s) this PR fixes:
Closes #3614