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

raft/autopilot: fix panic during autopilot shutdown #27726

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

jasonodonnell
Copy link
Contributor

Sometimes autopilot can cause a panic when shutdown logic is triggered (stepping down from active duty) because we aren't waiting for autopilot to shutdown gracefully.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x78 pc=0x1c66537]

goroutine 907 [running]:
github.com/hashicorp/raft-autopilot.(*Autopilot).GetState(0xc0005ec850?)
    /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/autopilot.go:222 +0x37
github.com/hashicorp/vault/physical/raft.(*Delegate).KnownServers(0xc006eca120)
    /home/runner/actions-runner/_work/vault-enterprise/vault-enterprise/physical/raft/raft_autopilot.go:389 +0xfc
github.com/hashicorp/raft-autopilot.(*Autopilot).gatherNextStateInputs(0xc006ecc000, {0x89cd4b8, 0xc006e92370})
    /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/state.go:115 +0x27c
github.com/hashicorp/raft-autopilot.(*Autopilot).nextState(0xc005f96f70?, {0x89cd4b8?, 0xc006e92370?})
    /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/state.go:185 +0x28
github.com/hashicorp/raft-autopilot.(*Autopilot).updateState(0xc006ecc000, {0x89cd4b8?, 0xc006e92370?})
    /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/state.go:403 +0x46
github.com/hashicorp/raft-autopilot.(*Autopilot).runStateUpdater(0xc006ecc000, {0x89cd4b8, 0xc006e92370}, 0xc006ec4540)
    /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/run.go:190 +0x114
created by github.com/hashicorp/raft-autopilot.(*Autopilot).beginExecution
    /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/run.go:121 +0x13d

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Jul 9, 2024
@jasonodonnell jasonodonnell added backport/ent/1.15.x+ent backport/ent/1.16.x+ent Changes are backported to 1.16.x+ent labels Jul 9, 2024
@jasonodonnell jasonodonnell added this to the 1.17.3 milestone Jul 9, 2024
Copy link

github-actions bot commented Jul 9, 2024

CI Results:
All Go tests succeeded! ✅

Copy link

github-actions bot commented Jul 9, 2024

Build Results:
All builds succeeded! ✅

Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@raskchanky raskchanky left a comment

Choose a reason for hiding this comment

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

@jasonodonnell jasonodonnell enabled auto-merge (squash) July 9, 2024 16:50
@jasonodonnell jasonodonnell merged commit 2a09bd4 into main Jul 9, 2024
83 checks passed
@jasonodonnell jasonodonnell deleted the autopilot-panic branch July 9, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.16.x+ent Changes are backported to 1.16.x+ent hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants