Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix race condition between server shutdown and consumer info #6356

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions server/jetstream_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4701,10 +4701,14 @@ func (s *Server) jsConsumerInfoRequest(sub *subscription, c *client, _ *Account,
return
}

js.mu.RLock()
meta := cc.meta
js.mu.RUnlock()

// Since these could wait on the Raft group lock, don't do so under the JS lock.
ourID := cc.meta.ID()
groupLeader := cc.meta.GroupLeader()
groupCreated := cc.meta.Created()
ourID := meta.ID()
groupLeader := meta.GroupLeader()
groupCreated := meta.Created()

js.mu.RLock()
isLeader, sa, ca := cc.isLeader(), js.streamAssignment(acc.Name, streamName), js.consumerAssignment(acc.Name, streamName, consumerName)
Expand Down
Loading