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

Skip processing consumer assignments after JS has shutdown #4625

Merged
merged 1 commit into from Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/consumer.go
Expand Up @@ -1593,6 +1593,10 @@ func (o *consumer) deleteNotActive() {
defer ticker.Stop()
for range ticker.C {
js.mu.RLock()
if js.shuttingDown {
js.mu.RUnlock()
return
}
nca := js.consumerAssignment(acc, stream, name)
js.mu.RUnlock()
// Make sure this is not a new consumer with the same name.
Expand Down
8 changes: 7 additions & 1 deletion server/jetstream_cluster.go
Expand Up @@ -2705,6 +2705,11 @@ func (mset *stream) resetClusteredState(err error) bool {

if sa != nil {
js.mu.Lock()
if js.shuttingDown {
js.mu.Unlock()
return
}

s.Warnf("Resetting stream cluster state for '%s > %s'", sa.Client.serviceAccount(), sa.Config.Name)
// Now wipe groups from assignments.
sa.Group.node = nil
Expand Down Expand Up @@ -3893,6 +3898,7 @@ func (js *jetStream) processConsumerAssignment(ca *consumerAssignment) {
s, cc := js.srv, js.cluster
accName, stream, consumerName := ca.Client.serviceAccount(), ca.Stream, ca.Name
noMeta := cc == nil || cc.meta == nil
shuttingDown := js.shuttingDown
var ourID string
if !noMeta {
ourID = cc.meta.ID()
Expand All @@ -3903,7 +3909,7 @@ func (js *jetStream) processConsumerAssignment(ca *consumerAssignment) {
}
js.mu.RUnlock()

if s == nil || noMeta {
if s == nil || noMeta || shuttingDown {
return
}

Expand Down