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

Fix the handling of removing disconnected streams to avoid a panic when multiple streams disconnect from the sdkserver #3668

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

roberthbailey
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking

/kind bug

/kind cleanup
/kind documentation
/kind feature
/kind hotfix
/kind release

What this PR does / Why we need it: Fixes a runtime panic when multiple streams disconnect from the sdkserver. This happens when a game server creates more than one watch and then closes them all at the same time. Normally, watches last for the lifetime of a game server, but if a game server intentionally disconnects watches and/or expects to be able to exit and restart (which implicitly disconnects the watches) then we hit this edge case.

Which issue(s) this PR fixes:

Closes #3640

Special notes for your reviewer: I tested this fix two ways:

  1. The new unit test fails with the old code paths with the error:
--- FAIL: TestSDKServer_SendGameServerUpdateRemovesDisconnectedStream (2.01s)
panic: runtime error: slice bounds out of range [2:1] [recovered]
	panic: runtime error: slice bounds out of range [2:1]
  1. I installed the fix into a test cluster and verified that the nodejs sample program that triggered the panic previously no longer does so.

@github-actions github-actions bot added kind/bug These are bugs. size/S labels Feb 21, 2024
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 63cdec2d-ffa5-42c9-b907-f0f06174ffa2

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3668/head:pr_3668 && git checkout pr_3668
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.39.0-dev-4dd7800-amd64

Copy link
Collaborator

@zmerlynn zmerlynn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok either way with the below comment - leave it if you wish. :)

pkg/sdkserver/sdkserver.go Show resolved Hide resolved
@zmerlynn zmerlynn merged commit 4b0f725 into googleforgames:main Feb 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug These are bugs. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

runtime.boundsError from watchGameServer
3 participants