Skip to content

fix: set GameServer to Unhealthy on container crash before Ready in sidecar mode - #4770

Merged
markmandel merged 1 commit into
agones-dev:mainfrom
bknote71:fix/sidecar-game-container-crash-before-ready
Oct 12, 2026
Merged

markmandel merged 1 commit into
agones-dev:mainfrom
bknote71:fix/sidecar-game-container-crash-before-ready

Conversation

@bknote71

@bknote71 bknote71 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind bug

What this PR does / Why we need it:

In sidecar mode, a game container that exits with a non-zero code cannot restart.
Remove the skip for game container failures before Ready.
When another container keeps the Pod Running, that skip can leave the GameServer Scheduled indefinitely.

Add a regression test for this case.

Which issue(s) this PR fixes:
Closes #4769

Did you use AI tools in preparing this PR?:
Yes. This PR was written in part with the assistance of generative AI.

Special notes for your reviewer:

@github-actions github-actions Bot added kind/bug These are bugs. size/S labels Oct 8, 2026
@markmandel

Copy link
Copy Markdown
Member

/gcbrun

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: 4a94d678-dfb7-4af6-bf8f-c49e93ea58dc

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/4770/head:pr_4770 && git checkout pr_4770
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.62.0-dev-85a4094

@markmandel markmandel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using:

func TestGameServerRestartBeforeReadyCrash(t *testing.T) {

I'd like a e2e test for this as well to make sure we have an integration test.

Comment thread pkg/gameservers/health.go
// With SidecarContainers, failedContainer only reports failures that cannot restart.
// on move to stable, this function can be deleted.
if runtime.FeatureEnabled(runtime.FeatureSidecarContainers) {
if gs.IsBeforeReady() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

well that makes things easier.

@bknote71
bknote71 force-pushed the fix/sidecar-game-container-crash-before-ready branch from 85a4094 to 77cb703 Compare October 10, 2026 10:42
@bknote71

Copy link
Copy Markdown
Contributor Author

Using:

func TestGameServerRestartBeforeReadyCrash(t *testing.T) {

I'd like a e2e test for this as well to make sure we have an integration test.

Hi @markmandel, I added e2e coverage to TestGameServerRestartBeforeReadyCrash with SidecarContainers enabled.

Comment thread test/e2e/gameserver_test.go
@bknote71
bknote71 force-pushed the fix/sidecar-game-container-crash-before-ready branch from 77cb703 to 2f4652c Compare October 11, 2026 05:50
@markmandel
markmandel requested a balanced review from Copilot October 11, 2026 22:13
@markmandel

Copy link
Copy Markdown
Member

/gcbrun

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The end-to-end test can fail intermittently because its fixed two-second crash races the exact-state wait for Scheduled.

1 open finding
What changed in this PR

Fixes GameServers remaining Scheduled when their game container crashes before Ready in sidecar mode.

Changes:

  • Removes the pre-Ready unhealthy skip for sidecar mode.
  • Adds unit and end-to-end regression coverage.
File Description
pkg/​gameservers/​health.go Allows unrestartable container failures to become Unhealthy.
pkg/​gameservers/​health_test.go Covers pre-Ready failure with another running container.
test/​e2e/​gameserver_test.go Adds sidecar-mode crash regression test.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/e2e/gameserver_test.go Outdated
assert.NoError(t, err)
}

func TestGameServerUnHealthyBeforeReadyCrash(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very small nit - I didn't even see it - but would be a nice change. But not suuuuuper important.

@bknote71 bknote71 Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, renamed it.

@markmandel markmandel added area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. and removed area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. labels Oct 11, 2026
@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: a3ec64f0-0b80-4244-ad1f-648132baf5e9

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/4770/head:pr_4770 && git checkout pr_4770
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.62.0-dev-2f4652c

@bknote71
bknote71 force-pushed the fix/sidecar-game-container-crash-before-ready branch 2 times, most recently from c58ee83 to 8b82682 Compare October 12, 2026 01:44

@markmandel markmandel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Noice

@markmandel
markmandel enabled auto-merge (squash) October 12, 2026 02:28
@markmandel

Copy link
Copy Markdown
Member

/gcbrun

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Failed 😭

Build Id: e46af990-94c8-430a-8f5b-964d117bac84

Status: FAILURE

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel

Copy link
Copy Markdown
Member

oops, just updated the linters and you got caught :) sorry about that!

…idecar mode

Signed-off-by: bknote71 <bknote71@gmail.com>
auto-merge was automatically disabled October 12, 2026 04:10

Head branch was pushed to by a user without write access

@bknote71
bknote71 force-pushed the fix/sidecar-game-container-crash-before-ready branch from 8b82682 to 34e757d Compare October 12, 2026 04:10
@markmandel

Copy link
Copy Markdown
Member

/gcbrun

@markmandel
markmandel enabled auto-merge (squash) October 12, 2026 17:40
@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: c44b4e27-2fb8-4709-9fa3-f3f9f191b438

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/4770/head:pr_4770 && git checkout pr_4770
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.62.0-dev-34e757d

@markmandel
markmandel merged commit 1c071a1 into agones-dev:main Oct 12, 2026
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.

GameServer remains Scheduled when its container crashes before Ready

4 participants